Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 8.94 KB | None | 0 0
  1. :: Installer to be run post-image to ensure that BADWI has been completed. (Ask Doug Rogers)
  2. :: If you don't need BADWI done, and just need the BIOS done, look in the bios_only folder.
  3.  
  4. @echo off
  5.  
  6. ::Add runtime to log
  7. echo %username%,%time%,%date% >> "\\Network_Location$\run_log2.csv"
  8.  
  9. :: Grab the BIOS version and Model Number
  10. FOR /F "tokens=2" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  11. FOR /F "tokens=2*" %%a in ('wmic csproduct get name') do SET modelnum=%%a%%b
  12.  
  13. :: Exceptions for the BIOS version (some machines output it funny)
  14. if "%modelnum%" == "CompaqPro 6305 SFF  " FOR /F "tokens=2" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  15. if "%modelnum%" == "ProBook645 G1  " FOR /F "tokens=2*" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a%%b
  16. if "%modelnum%" == "EliteBook745 G3  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  17. if "%modelnum%" == "EliteBook745 G4  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  18. if "%modelnum%" == "EliteBook755 G3  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  19. if "%modelnum%" == "EliteBook755 G4  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  20. if "%modelnum%" == "EliteDesk705 G2 MT  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  21. if "%modelnum%" == "EliteDesk705 G3 MT  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  22. if "%modelnum%" == "EliteDesk705 G3 SFF  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  23. if "%modelnum%" == "Elitex2 1012 G1  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  24. if "%modelnum%" == "ProBook6475b  " FOR /F "tokens=3" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  25.  
  26. :: Determine whether word is activated. If yes, don't start word. Go straight to device manager. If no, start word and wait for the activation window to open.
  27. :: Then, close word, and go to device manager.
  28. :wordsearch
  29. taskkill /f /im  OneDriveSetup.exe
  30. set activated=" "
  31. for /f "tokens=3 delims= " %%a in ('cscript "%ProgramFiles%\Microsoft Office\Office16\OSPP.VBS" /dstatus ^| find /i "License Status:"') do (
  32. set "licenseStatus=%%a"
  33. )
  34.  
  35. if /i "%licenseStatus%"=="---LICENSED---" (
  36.         set activated="yes" & goto devmgr
  37.     ) Else (
  38.         set activated="no" & start winword.exe & goto wordnotactivated
  39.     )
  40.    
  41. :: If word isn't activated, open word, wait for activator, go to kill word.
  42. :wordnotactivated
  43. echo Waiting for activation to start...
  44. timeout /t 5 /NOBREAK
  45. tasklist /v|find "Microsoft Office Professional Plus 2016"
  46. if %errorlevel% equ 0 (timeout /t 5 /NOBREAK && goto killword) else (goto wordnotactivated)
  47.  
  48. :killword
  49. taskkill /F /IM winword.exe
  50. goto devmgr
  51.  
  52. :: Open Device Manager to confirm changes to drivers
  53. :devmgr
  54. echo \\Network_Location\Laptop\HP | clip
  55. echo You might want these laptop drivers: \\Network_Location\HP
  56. echo Or you might want these desktop drivers: \\Network_Location\HP
  57. hdwwiz.cpl
  58. pause
  59. goto copyauto2
  60.  
  61. :copyauto2
  62. xcopy "\\Network_Location$\afterimage_autoinstaller2.lnk" C:\Users\Public\Desktop\
  63. goto bios
  64.  
  65. :: Make SWSetup folder.
  66. :bios
  67. C:
  68. md C:\SWSetup
  69.  
  70. :: Determine which machine it is
  71. echo %modelnum%
  72. if "%modelnum%" == "EliteDesk705 G1 MT  " echo We found your model number! Press any key to begin BIOS update. & goto 705g1
  73. if "%modelnum%" == "EliteDesk705 G1 SFF  " echo We found your model number! Press any key to begin BIOS update. & goto 705g1
  74. if "%modelnum%" == "EliteDesk705 G2 MT  " echo We found your model number! Press any key to begin BIOS update. & goto 705g2
  75. if "%modelnum%" == "EliteDesk705 G2 SFF  " echo We found your model number! Press any key to begin BIOS update. & goto 705g2
  76. if "%modelnum%" == "EliteDesk705 G3 MT  " echo We found your model number! Press any key to begin BIOS update. & goto 705g3
  77. if "%modelnum%" == "EliteDesk705 G3 SFF  " echo We found your model number! Press any key to begin BIOS update. & goto 705g3sff
  78. if "%modelnum%" == "Compaq6005 Pro MT PC  " echo We found your model number! Press any key to begin BIOS update. & goto 6005
  79. if "%modelnum%" == "CompaqPro 6305 MT  " echo We found your model number! Press any key to begin BIOS update. & goto 6305
  80. if "%modelnum%" == "CompaqPro 6305 SFF  " echo We found your model number! Press any key to begin BIOS update. & goto 6305
  81. if "%modelnum%" == "ProBook645 G1  " echo We found your model number! Press any key to begin BIOS update. & goto 645g1
  82. if "%modelnum%" == "EliteBook745 G3  " echo We found your model number! Press any key to begin BIOS update. & goto 745g3
  83. if "%modelnum%" == "EliteBook745 G4  " echo We found your model number! Press any key to begin BIOS update. & goto 745g4
  84. if "%modelnum%" == "EliteBook755 G3  " echo We found your model number! Press any key to begin BIOS update. & goto 745g3
  85. if "%modelnum%" == "EliteBook755 G4  " echo We found your model number! Press any key to begin BIOS update. & goto 745g4
  86. if "%modelnum%" == "Elitex2 1012 G1  " echo We found your model number! Press any key to begin BIOS update. & goto elitex2
  87. if "%modelnum%" == "ProBook6475b  " echo We found your model number! Press any key to begin BIOS update. & goto 6475b
  88.  
  89. echo Your machine model doesn't match anything on record. Please manually upgrade your BIOS. Thanks!
  90. pause
  91. exit
  92.  
  93. :: Copy BIOS files and run installer based on %modelnum%, and determine whether they're up to date using %biosver%. If you want to add an updated bios installer,
  94. :: you have to change the file path three times, copy the extracted files to the new path, and update the %biosver% that you want it to look for by checking
  95. :: the tokens.
  96.  
  97. :6475b
  98. FOR /F "tokens=1" %%a in ('wmic bios get smbiosbiosversion') do SET biosver=%%a
  99. echo Your bios version is %biosver%. It should be F.69.
  100. if "%biosver%"== "F.69" echo Your machine BIOS (%biosver%) is already up to date. & pause & exit
  101. "\\Network_Location$\HP Probook 6475b\sp86984\hpqFlash64.exe"
  102. pause
  103. exit
  104.  
  105.  
  106. :645g1
  107. echo Your bios version is %biosver%. It should be Ver.01.47.
  108. if "%biosver%"== "Ver.01.47     " echo Your machine BIOS (%biosver%) is already up to date. & pause & exit
  109. xcopy /E "\\Network_Location$\HP ProBook 645-655 G1\sp91527" C:\SWSetup\sp91527\
  110. C:\SWSetup\sp91527\HPBIOSUPDREC64.exe
  111. pause
  112. exit
  113.  
  114. :745g3
  115. echo Your bios version is %biosver%. It should be 01.23.
  116. if "%biosver%"=="01.23" echo Your machine BIOS (%biosver%) is already up to date. & pause & exit
  117. xcopy /E "\\Network_Location$\HP EliteBook 745-755 G3\sp87012" C:\SWSetup\sp87012\
  118. C:\SWSetup\sp87012\HPBIOSUPDREC64.exe
  119. pause
  120. exit
  121.  
  122. :745g4
  123. echo Your bios version is %biosver%. It should be 01.24.
  124. if "%biosver%"=="01.24" echo Your machine BIOS (%biosver%) is already up to date. & pause & exit
  125. xcopy /E "\\Network_Location$\HP EliteBook 745-755 G4\sp91953" C:\SWSetup\sp91953\
  126. C:\SWSetup\sp91953\HPBIOSUPDREC64.exe
  127. pause
  128. exit
  129.  
  130. :705g1
  131. echo Your bios version is %biosver%. It should be 02.31.
  132. if "%biosver%"=="v02.31" echo Your machine BIOS is already up to date. & pause && exit
  133. xcopy /E "\\Network_Location$\HP EliteDesk 705 G1\sp92165" C:\SWSetup\sp92165\
  134. C:\SWSetup\sp92165\HPBIOSUPDREC\HPBIOSUPDREC64.exe
  135. pause
  136. exit
  137.  
  138. :705g2
  139. echo Your bios version is %biosver%. It should be 02.36.
  140. if "%biosver%"=="02.36" echo Your machine BIOS is already up to date. & pause && exit
  141. xcopy /E "\\Network_Location$\HP EliteDesk 705 G2\sp91379" C:\SWSetup\sp91379\
  142. C:\SWSetup\sp91379\HPBIOSUPDREC\HPBIOSUPDREC64.exe
  143. pause
  144. exit
  145.  
  146. :705g3
  147. echo Your bios version is %biosver%. It should be 02.13.
  148. if "%biosver%"=="02.13" echo Your machine BIOS is already up to date. & pause && exit
  149. xcopy /E "\\Network_Location$\HP EliteDesk 705 G3\sp91967" C:\SWSetup\sp91967\
  150. C:\SWSetup\sp91967\HPBIOSUPDREC\HPBIOSUPDREC64.exe
  151. pause
  152. exit
  153.  
  154. :705g3sff
  155. echo Your bios version is %biosver%. It should be 02.17.
  156. if "%biosver%"=="02.17" echo Your machine BIOS is already up to date. & pause && exit
  157. xcopy /E "\\Network_Location$\HP EliteDesk 705 G3 SFF\sp91966" C:\SWSetup\sp91966\
  158. C:\SWSetup\sp91966\HPBIOSUPDREC\HPBIOSUPDREC64.exe
  159. pause
  160. exit
  161.  
  162. :6005
  163. echo Your bios version is %biosver%. It should be v01.17.
  164. if "%biosver%"=="v01.17" echo Your machine BIOS is already up to date. & pause && exit
  165. xcopy /E "\\Network_Location$\HP Compaq 6005 Pro\sp57308" C:\SWSetup\sp57308\
  166. C:\SWSetup\sp57308\HPQFlash\HpqFlash.exe
  167. pause
  168. exit
  169.  
  170. :6305
  171. echo Your bios version is %biosver%. It should be v02.77.
  172. if "%biosver%"=="v02.77" echo Your machine BIOS is already up to date. & pause && exit
  173. xcopy /E "\\Network_Location$\HP Compaq Pro 6305\sp87071" C:\SWSetup\sp87071\
  174. C:\SWSetup\sp87071\HPQFlash\HpqFlash.exe
  175. pause
  176. exit
  177.  
  178. :elitex2
  179. echo Your bios version is %biosver%. It should be 01.29.
  180. if "%biosver%"=="01.29" echo Your machine BIOS is already up to date. & pause && exit
  181. xcopy /E "\\Network_Location$\HP Elite x2 1012 G1\sp85132 (BIOS 1.29)" C:\SWSetup\sp85132\
  182. C:\SWSetup\sp85132\HPBIOSUPDREC.exe
  183. pause
  184. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement