Guest User

Script Windows Update

a guest
Nov 4th, 2016
17,867
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @ECHO OFF
  2.  
  3. CD %windir%\system32
  4. ECHO Stopping Services
  5.  
  6. net stop bits
  7. net stop wuauserv
  8. net stop cryptsvc
  9.  
  10. ECHO Delete Downloaded Updates
  11.  
  12. DEL "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
  13.  
  14. ECHO Clear Update Cache
  15.  
  16. REN %systemroot%\SoftwareDistribution SoftwareDistribution.old
  17. REN %systemroot%\system32\catroot2 catroot2.old
  18. MKDIR %systemroot%\system32\catroot2
  19.  
  20. ECHO Reset BITS
  21.  
  22. sc config BITS binPath= "C:\Windows\System32\svchost.exe -k netsvcs" DisplayName= "Background Intelligent Transfer Service" depend= Rpcss/EventSystem start= auto obj= "LocalSystem" password= ""
  23. sc description BITS "Transfers files in the background using idle network bandwidth. If the service is disabled, then any applications that depend on BITS, such as Windows Update or MSN Explorer, will be unable to automatically download programs and other information."
  24. sc privs BITS SeCreateGlobalPrivilege/SeImpersonatePrivilege/SeTcbPrivilege/SeAssignPrimaryTokenPrivilege/SeIncreaseQuotaPrivilege
  25. sc sdset BITS D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;SAFA;WDWO;;;BA)
  26. sc sidtype BITS UNRESTRICTED
  27.  
  28. ECHO Reset Windows Update
  29.  
  30. sc config wuauserv binPath= "C:\Windows\System32\svchost.exe -k netsvcs" DisplayName= "Windows Update" depend= Rpcss start= auto obj= "LocalSystem" password= ""
  31. sc privs wuauserv SeAuditPrivilege/SeCreateGlobalPrivilege/SeCreatePageFilePrivilege/SeTcbPrivilege/SeAssignPrimaryTokenPrivilege/SeImpersonatePrivilege/SeIncreaseQuotaPrivilege/SeShutdownPrivilege
  32. sc sdset wuauserv D:(A;;CCLCSWRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOSDRCWDWO;;;WD)
  33. sc sidtype wuauserv UNRESTRICTED
  34.  
  35. ECHO Reset Cryptographic Services
  36.  
  37. sc config CryptSvc binPath= "C:\Windows\system32\svchost.exe -k NetworkService" DisplayName= "Cryptographic Services" depend= Rpcss start= auto obj= "NT Authority\NetworkService" password= ""
  38. sc privs CryptSvc SeChangeNotifyPrivilege/SeCreateGlobalPrivilege/SeImpersonatePrivilege
  39. sc sdset CryptSvc D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
  40. sc sidtype CryptSvc UNRESTRICTED
  41.  
  42. ECHO Reset WMI Repository
  43.  
  44. net stop winmgmt
  45. REN %systemroot%\system32\wbem\Repository Repository.old
  46.  
  47. ECHO Register Components
  48.  
  49. REGSVR32.EXE /u /s /i atl.dll
  50. REGSVR32.EXE /u /s /i urlmon.dll
  51. REGSVR32.EXE /u /s /i mshtml.dll
  52. REGSVR32.EXE /u /s /i shdocvw.dll
  53. REGSVR32.EXE /u /s /i browseui.dll
  54. REGSVR32.EXE /u /s /i jscript.dll
  55. REGSVR32.EXE /u /s /i vbscript.dll
  56. REGSVR32.EXE /u /s /i scrrun.dll
  57. REGSVR32.EXE /u /s /i msxml.dll
  58. REGSVR32.EXE /u /s /i msxml6.dll
  59. REGSVR32.EXE /u /s /i msxml3.dll
  60. REGSVR32.EXE /u /s /i actxprxy.dll
  61. REGSVR32.EXE /u /s /i softpub.dll
  62. REGSVR32.EXE /u /s /i wintrust.dll
  63. REGSVR32.EXE /u /s /i dssenh.dll
  64. REGSVR32.EXE /u /s /i gpkcsp.dll
  65. REGSVR32.EXE /u /s /i rsaenh.dll
  66. REGSVR32.EXE /u /s /i sccbase.dll
  67. REGSVR32.EXE /u /s /i slbcsp.dll
  68. REGSVR32.EXE /u /s /i cryptdlg.dll
  69. REGSVR32.EXE /u /s /i oleaut32.dll
  70. REGSVR32.EXE /u /s /i ole32.dll
  71. REGSVR32.EXE /u /s /i shell32.dll
  72. REGSVR32.EXE /u /s /i initpki.dll
  73. REGSVR32.EXE /u /s /i wuapi.dll
  74. REGSVR32.EXE /u /s /i wuaueng.dll
  75. REGSVR32.EXE /u /s /i wuaueng1.dll
  76. REGSVR32.EXE /u /s /i wucltui.dll
  77. REGSVR32.EXE /u /s /i wups.dll
  78. REGSVR32.EXE /u /s /i wups2.dll
  79. REGSVR32.EXE /u /s /i wuweb.dll
  80. REGSVR32.EXE /u /s /i qmgr.dll
  81. REGSVR32.EXE /u /s /i qmgrprxy.dll
  82. REGSVR32.EXE /u /s /i wucltux.dll
  83. REGSVR32.EXE /u /s /i muweb.dll
  84. REGSVR32.EXE /u /s /i wuwebv.dll
  85.  
  86. BitsAdmin /RESET /allusers
  87.  
  88. ECHO Start Services
  89.  
  90. net start wuauserv
  91. net start cryptsvc
  92. net start bits
  93.  
  94. MSIEXEC /unregister
  95. MSIEXEC /regserver
  96. REGSVR32 /u /s /i MSI.dll
  97.  
  98. ECHO Finishing Up
  99. @ECHO OFF
  100.  
  101. CD %windir%\system32
  102. ECHO Stopping Services
  103.  
  104. net stop bits
  105. net stop wuauserv
  106. net stop cryptsvc
  107.  
  108. ECHO Delete Downloaded Updates
  109.  
  110. DEL "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
  111.  
  112. ECHO Clear Update Cache
  113.  
  114. REN %systemroot%\SoftwareDistribution SoftwareDistribution.old
  115. REN %systemroot%\system32\catroot2 catroot2.old
  116. MKDIR %systemroot%\system32\catroot2
  117.  
  118. ECHO Reset BITS
  119.  
  120. sc config BITS binPath= "C:\Windows\System32\svchost.exe -k netsvcs" DisplayName= "Background Intelligent Transfer Service" depend= Rpcss/EventSystem start= auto obj= "LocalSystem" password= ""
  121. sc description BITS "Transfers files in the background using idle network bandwidth. If the service is disabled, then any applications that depend on BITS, such as Windows Update or MSN Explorer, will be unable to automatically download programs and other information."
  122. sc privs BITS SeCreateGlobalPrivilege/SeImpersonatePrivilege/SeTcbPrivilege/SeAssignPrimaryTokenPrivilege/SeIncreaseQuotaPrivilege
  123. sc sdset BITS D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;SAFA;WDWO;;;BA)
  124. sc sidtype BITS UNRESTRICTED
  125.  
  126. ECHO Reset Windows Update
  127.  
  128. sc config wuauserv binPath= "C:\Windows\System32\svchost.exe -k netsvcs" DisplayName= "Windows Update" depend= Rpcss start= auto obj= "LocalSystem" password= ""
  129. sc privs wuauserv SeAuditPrivilege/SeCreateGlobalPrivilege/SeCreatePageFilePrivilege/SeTcbPrivilege/SeAssignPrimaryTokenPrivilege/SeImpersonatePrivilege/SeIncreaseQuotaPrivilege/SeShutdownPrivilege
  130. sc sdset wuauserv D:(A;;CCLCSWRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOSDRCWDWO;;;WD)
  131. sc sidtype wuauserv UNRESTRICTED
  132.  
  133. ECHO Reset Cryptographic Services
  134.  
  135. sc config CryptSvc binPath= "C:\Windows\system32\svchost.exe -k NetworkService" DisplayName= "Cryptographic Services" depend= Rpcss start= auto obj= "NT Authority\NetworkService" password= ""
  136. sc privs CryptSvc SeChangeNotifyPrivilege/SeCreateGlobalPrivilege/SeImpersonatePrivilege
  137. sc sdset CryptSvc D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
  138. sc sidtype CryptSvc UNRESTRICTED
  139.  
  140. ECHO Reset WMI Repository
  141.  
  142. net stop winmgmt
  143. REN %systemroot%\system32\wbem\Repository Repository.old
  144.  
  145. ECHO Register Components
  146.  
  147. REGSVR32.EXE /u /s /i atl.dll
  148. REGSVR32.EXE /u /s /i urlmon.dll
  149. REGSVR32.EXE /u /s /i mshtml.dll
  150. REGSVR32.EXE /u /s /i shdocvw.dll
  151. REGSVR32.EXE /u /s /i browseui.dll
  152. REGSVR32.EXE /u /s /i jscript.dll
  153. REGSVR32.EXE /u /s /i vbscript.dll
  154. REGSVR32.EXE /u /s /i scrrun.dll
  155. REGSVR32.EXE /u /s /i msxml.dll
  156. REGSVR32.EXE /u /s /i msxml6.dll
  157. REGSVR32.EXE /u /s /i msxml3.dll
  158. REGSVR32.EXE /u /s /i actxprxy.dll
  159. REGSVR32.EXE /u /s /i softpub.dll
  160. REGSVR32.EXE /u /s /i wintrust.dll
  161. REGSVR32.EXE /u /s /i dssenh.dll
  162. REGSVR32.EXE /u /s /i gpkcsp.dll
  163. REGSVR32.EXE /u /s /i rsaenh.dll
  164. REGSVR32.EXE /u /s /i sccbase.dll
  165. REGSVR32.EXE /u /s /i slbcsp.dll
  166. REGSVR32.EXE /u /s /i cryptdlg.dll
  167. REGSVR32.EXE /u /s /i oleaut32.dll
  168. REGSVR32.EXE /u /s /i ole32.dll
  169. REGSVR32.EXE /u /s /i shell32.dll
  170. REGSVR32.EXE /u /s /i initpki.dll
  171. REGSVR32.EXE /u /s /i wuapi.dll
  172. REGSVR32.EXE /u /s /i wuaueng.dll
  173. REGSVR32.EXE /u /s /i wuaueng1.dll
  174. REGSVR32.EXE /u /s /i wucltui.dll
  175. REGSVR32.EXE /u /s /i wups.dll
  176. REGSVR32.EXE /u /s /i wups2.dll
  177. REGSVR32.EXE /u /s /i wuweb.dll
  178. REGSVR32.EXE /u /s /i qmgr.dll
  179. REGSVR32.EXE /u /s /i qmgrprxy.dll
  180. REGSVR32.EXE /u /s /i wucltux.dll
  181. REGSVR32.EXE /u /s /i muweb.dll
  182. REGSVR32.EXE /u /s /i wuwebv.dll
  183.  
  184. BitsAdmin /RESET /allusers
  185.  
  186. ECHO Start Services
  187.  
  188. net start wuauserv
  189. net start cryptsvc
  190. net start bits
  191.  
  192. MSIEXEC /unregister
  193. MSIEXEC /regserver
  194. REGSVR32 /u /s /i MSI.dll
  195.  
  196. ECHO Finishing Up
RAW Paste Data