Advertisement
FreeBooter

Reset Windows Update Components

Jul 19th, 2022
2,388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 13.67 KB | None | 0 0
  1. :: Batch script created by FreeBooter
  2.  
  3. @Echo Off & Cls
  4.  
  5.  
  6. REM  --> Check for permissions
  7. Reg query "HKU\S-1-5-19\Environment"
  8. REM --> If error flag set, we do not have admin.
  9. if %errorlevel% NEQ 0 (
  10. ECHO                 **************************************
  11. ECHO                  Running Admin shell... Please wait...
  12. ECHO                 **************************************
  13.  
  14.     goto UACPrompt
  15. ) else ( goto gotAdmin )
  16.  
  17. :UACPrompt
  18.     echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
  19.     set params = "%*:"=""
  20.     echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
  21.  
  22.     "%temp%\getadmin.vbs"
  23.     del "%temp%\getadmin.vbs"
  24.     exit /B
  25.  
  26.  
  27. :gotAdmin
  28.  
  29. Mode CON LINES=5 COLS=50 & Color 0E
  30.  
  31. Echo                   PLEASE WAIT...
  32. ::Creating System Restore point
  33. Wmic.exe /Namespace:\\root\default Path SystemRestore Call CreateRestorePoint "Before Resetting Windows Update Components", 100, 12
  34.  
  35. Cls & Mode CON  LINES=30 COLS=84 & Color 0D
  36.  
  37. Cd %~dp0
  38. Call :IsAdmin
  39.  
  40.  
  41.  
  42. If Exist %UserProfile%\Desktop\WinUpResetLog.txt Del %UserProfile%\Desktop\WinUpResetLog.txt
  43. If Exist %TMP%\WinUpResetLog.txt Del %TMP%\WinUpResetLog.txt
  44.  
  45. Cls
  46. :: Manually Reset Windows Update Components
  47.  
  48. Echo.
  49. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  50. Echo.
  51. Echo.
  52. Echo                                PLEASE WAIT...
  53.  
  54.  
  55. Echo :: Stop the BITS service, the Windows Update service, and the Cryptographic service. >>%TMP%\WinUpResetLog.txt
  56.                    Net stop bits 2>>%TMP%\WinUpResetLog.txt
  57.                    Net stop wuauserv 2>>%TMP%\WinUpResetLog.txt
  58.                    Net stop appidsvc 2>>%TMP%\WinUpResetLog.txt
  59.                    Echo Y | Net stop cryptsvc 2>>%TMP%\WinUpResetLog.txt
  60.                    
  61. Cls                  
  62. Color 1E
  63.  
  64. Echo.
  65. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  66. Echo.
  67. Echo.
  68. Echo                                 PLEASE WAIT...
  69. Echo :: Change Directory. >>%TMP%\WinUpResetLog.txt
  70. Cd /d %Windir%\System32 1>nul
  71.  
  72. For /f "tokens=2 delims=[]" %%a in ('ver') do (set Version=%%a)
  73. Set Version=%Version:~8,2%
  74. If  NOT %Version%==5 (
  75.  
  76. Goto New_Win
  77.  
  78. ) Else (
  79.  
  80.  
  81. Proxycfg.exe -d 2>>%TMP%\WinUpResetLog.txt
  82. REGSVR32 C:\WINDOWS\SYSTEM32\WUAUENG.DLL /U /S
  83. REGSVR32 C:\WINDOWS\SYSTEM32\WUAUENG1.DLL /U /S
  84. REGSVR32 C:\WINDOWS\SYSTEM32\WUAPI.DLL /U /S
  85. REGSVR32 C:\WINDOWS\SYSTEM32\ATL.DLL /U /S
  86. REGSVR32 C:\WINDOWS\SYSTEM32\WUCLTUI.DLL /U /S
  87. REGSVR32 C:\WINDOWS\SYSTEM32\WUPS.DLL /U /S
  88. REGSVR32 C:\WINDOWS\SYSTEM32\WUPS2.DLL /S
  89. REGSVR32 C:\WINDOWS\SYSTEM32\IUENGINE.DLL /U /S
  90. REGSVR32 C:\WINDOWS\SYSTEM32\WUWEB.DLL /U /S
  91. REGSVR32 C:\WINDOWS\SYSTEM32\WUAUENG.DLL /S
  92. REGSVR32 C:\WINDOWS\SYSTEM32\WUAUENG1.DLL /S
  93. REGSVR32 C:\WINDOWS\SYSTEM32\WUAPI.DLL /S
  94. REGSVR32 C:\WINDOWS\SYSTEM32\ATL.DLL /S
  95. REGSVR32 C:\WINDOWS\SYSTEM32\WUCLTUI.DLL /S
  96. REGSVR32 C:\WINDOWS\SYSTEM32\WUPS.DLL /S
  97. REGSVR32 C:\WINDOWS\SYSTEM32\IUENGINE.DLL /S
  98. REGSVR32 C:\WINDOWS\SYSTEM32\WUWEB.DLL /S
  99. REGSVR32 VBSCRIPT.DLL /S
  100. REGSVR32 JSCRIPT.DLL /S
  101. REGSVR32 SCRRUN.DLL /S
  102. REGSVR32 DISPEX.DLL /S
  103. REGSVR32 MSSCRIPT.DLL /S
  104. REGSVR32 SOFTPUB.DLL /S
  105. REGSVR32 WINTRUST.DLL /S
  106. REGSVR32 INITPKI.DLL /S
  107. REGSVR32 URLMON.DLL /S
  108. REGSVR32 DSSENH.DLL /S
  109. REGSVR32 MSXML.DLL /S
  110. REGSVR32 MSXML2.DLL /S
  111. REGSVR32 MSXML3.DLL /S
  112. REGSVR32 RSAENH.DLL /S
  113. REGSVR32 GPKCSP.DLL /S
  114. REGSVR32 SCCBASE.DLL /S
  115. REGSVR32 SLBCSP.DLL /S
  116. REGSVR32 CRYPTDLG.DLL /S
  117. REGSVR32 MSSIP32.DLL /S
  118. )
  119.  
  120. Cls
  121. Echo.
  122. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  123. Echo.
  124. Echo.
  125. Echo                               PLEASE WAIT...
  126.  
  127.  
  128. :New_Win
  129. Echo :: Windows Automatic updates service could be missing, reinstall the component from its configuration file. >>%TMP%\WinUpResetLog.txt
  130. TASKKILL /F /IM rundll32.exe /T | %Windir%\System32\Rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 %windir%\inf\au.inf 2>>%TMP%\WinUpResetLog.txt
  131. Cls
  132.  
  133. Echo :: If Background Intelligent Transfer Service is missing, then click Start, click Run, type the following command. >>%TMP%\WinUpResetLog.txt
  134. TASKKILL /F /IM rundll32.exe /T | %Windir%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 %windir%\inf\qmgr.inf  2>>%TMP%\WinUpResetLog.txt
  135. Cls
  136.  
  137. Echo :: Creating the  BITS (Background Intelligent Transfer Service) Service. >>%TMP%\WinUpResetLog.txt
  138. Sc Create BITS type= share start= delayed-auto binPath= "C:\Windows\System32\svchost.exe -k netsvcs" tag= no DisplayName= "Background Intelligent Transfer Service" 2>>%TMP%\WinUpResetLog.txt
  139. Cls
  140.  
  141. Echo :: Reset the content of the Catroot2 folder. >>%TMP%\WinUpResetLog.txt
  142.   If Exist %Systemroot%\System32\catroot2.old  Rd /s /q %Systemroot%\System32\catroot2.old 2>>%TMP%\WinUpResetLog.txt
  143.   Md %Systemroot%\System32\catroot2.old 2>>%TMP%\WinUpResetLog.txt
  144.   Xcopy /y %Systemroot%\System32\catroot2 %systemroot%\system32\catroot2.old /s 2>>%TMP%\WinUpResetLog.txt
  145.   Ren %SystemRoot%\System32\catroot2 catroot2.bak 2>>%TMP%\WinUpResetLog.txt
  146.  
  147. Cls  
  148. Color 0B
  149.  
  150. Echo.
  151. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  152. Echo.
  153. Echo.
  154. Echo                                PLEASE WAIT...
  155.  
  156. Echo :: Delete the SoftareDistribution directory. >>%TMP%\WinUpResetLog.txt
  157.   Rd /s /q %SystemRoot%\SoftwareDistribution  2>>%TMP%\WinUpResetLog.txt
  158.   Cls
  159.  
  160. Echo :: Delete the qmgr*.dat files. >>%TMP%\WinUpResetLog.txt
  161.   Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" /f /q 2>>%TMP%\WinUpResetLog.txt
  162.   Del C:\Programdata\Microsoft\Network\Downloader\qmgr*.dat /f /q 2>>%TMP%\WinUpResetLog.txt
  163.   del /s /q /f "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" 2>>%TMP%\WinUpResetLog.txt
  164.   del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat" 2>>%TMP%\WinUpResetLog.txt
  165.   del /s /q /f "%SYSTEMROOT%\Logs\WindowsUpdate\*" 2>>%TMP%\WinUpResetLog.txt
  166.   Cls
  167.  
  168. Echo :: Delete any incorrect values that may exist in the registry. >>%TMP%\WinUpResetLog.txt
  169.   Reg  Delete HKEY_LOCAL_MACHINE\COMPONENTS /v PendingXmlIdentifier /f 2>>%TMP%\WinUpResetLog.txt
  170.   Reg  Delete HKEY_LOCAL_MACHINE\COMPONENTS /v NextQueueEntryIndex  /f 2>>%TMP%\WinUpResetLog.txt
  171.   Reg  Delete HKEY_LOCAL_MACHINE\COMPONENTS /v AdvancedInstallersNeedResolving /f 2>>%TMP%\WinUpResetLog.txt
  172.  
  173.   :: Reset Windows Update policies
  174. reg delete "HKCU\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f 2>>%TMP%\WinUpResetLog.txt
  175. reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f 2>>%TMP%\WinUpResetLog.txt
  176. reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f 2>>%TMP%\WinUpResetLog.txt
  177. reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f 2>>%TMP%\WinUpResetLog.txt
  178. gpupdate /force
  179.  
  180.  
  181. Cls
  182. Echo.
  183. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  184. Echo.
  185. Echo.
  186. Echo                                PLEASE WAIT...
  187.  
  188. Echo :: Rename Pending.xml file. >>%TMP%\WinUpResetLog.txt
  189.  Takeown /f C:\Windows\Winsxs\Pending.xml 2>>%TMP%\WinUpResetLog.txt
  190.  Ren C:\Windows\Winsxs\Pending.xml  Pending.xml.bak 2>>%TMP%\WinUpResetLog.txt
  191.  Cls
  192.  
  193.  
  194. Echo :: Reset the BITS service and the Windows Update service to the default security descriptor. >>%TMP%\WinUpResetLog.txt
  195. Sc sdset Bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) 2>>%TMP%\WinUpResetLog.txt
  196. Cls
  197. Sc sdset Wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) 2>>%TMP%\WinUpResetLog.txt
  198.  
  199. Echo :: Change Directory. >>%TMP%\WinUpResetLog.txt
  200. Cd /d %Windir%\System32 1>nul
  201.  
  202. Cls
  203. Echo.
  204. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  205. Echo.
  206. Echo.
  207. Echo                                PLEASE WAIT...
  208.  
  209.  
  210.  
  211. Echo :: Re-register the BITS dynamic-link librarys and the Windows Update dynamic-link librarys. >>%TMP%\WinUpResetLog.txt
  212.  
  213.  
  214. Regsvr32.exe /s mshtml.dll   2>>%TMP%\WinUpResetLog.txt
  215. Regsvr32.exe /s shdocvw.dll  2>>%TMP%\WinUpResetLog.txt    
  216. Regsvr32.exe /s browseui.dll 2>>%TMP%\WinUpResetLog.txt
  217. Regsvr32.exe /s msxml6.dll   2>>%TMP%\WinUpResetLog.txt
  218. Regsvr32.exe /s actxprxy.dll 2>>%TMP%\WinUpResetLog.txt
  219. Regsvr32.exe /s gpkcsp.dll   2>>%TMP%\WinUpResetLog.txt
  220. Regsvr32.exe /s oleaut32.dll 2>>%TMP%\WinUpResetLog.txt
  221. Regsvr32.exe /s ole32.dll    2>>%TMP%\WinUpResetLog.txt
  222. Regsvr32.exe /s shell32.dll  2>>%TMP%\WinUpResetLog.txt
  223. Regsvr32.exe /s qmgr.dll     2>>%TMP%\WinUpResetLog.txt
  224. Regsvr32.exe /s qmgrprxy.dll 2>>%TMP%\WinUpResetLog.txt
  225. Regsvr32.exe /s wucltux.dll  2>>%TMP%\WinUpResetLog.txt  
  226. Regsvr32.exe /s wuwebv.dll   2>>%TMP%\WinUpResetLog.txt
  227. Regsvr32.exe /s wudriver.dll 2>>%TMP%\WinUpResetLog.txt
  228. REGSVR32 C:\WINDOWS\SYSTEM32\WUAUENG.DLL /U /S
  229. REGSVR32 C:\WINDOWS\SYSTEM32\WUAUENG1.DLL /U /S
  230. REGSVR32 C:\WINDOWS\SYSTEM32\WUAPI.DLL /U /S
  231. REGSVR32 C:\WINDOWS\SYSTEM32\ATL.DLL /U /S
  232. REGSVR32 C:\WINDOWS\SYSTEM32\WUCLTUI.DLL /U /S
  233. REGSVR32 C:\WINDOWS\SYSTEM32\WUPS.DLL /U /S
  234. REGSVR32 C:\WINDOWS\SYSTEM32\WUPS2.DLL /S
  235. REGSVR32 C:\WINDOWS\SYSTEM32\IUENGINE.DLL /U /S
  236. REGSVR32 C:\WINDOWS\SYSTEM32\WUWEB.DLL /U /S
  237. REGSVR32 C:\WINDOWS\SYSTEM32\WUAUENG.DLL /S
  238. REGSVR32 C:\WINDOWS\SYSTEM32\WUAUENG1.DLL /S
  239. REGSVR32 C:\WINDOWS\SYSTEM32\WUAPI.DLL /S
  240. REGSVR32 C:\WINDOWS\SYSTEM32\ATL.DLL /S
  241. REGSVR32 C:\WINDOWS\SYSTEM32\WUCLTUI.DLL /S
  242. REGSVR32 C:\WINDOWS\SYSTEM32\WUPS.DLL /S
  243. REGSVR32 C:\WINDOWS\SYSTEM32\IUENGINE.DLL /S
  244. REGSVR32 C:\WINDOWS\SYSTEM32\WUWEB.DLL /S
  245. REGSVR32 VBSCRIPT.DLL /S
  246. REGSVR32 JSCRIPT.DLL /S
  247. REGSVR32 SCRRUN.DLL /S
  248. REGSVR32 DISPEX.DLL /S
  249. REGSVR32 MSSCRIPT.DLL /S
  250. REGSVR32 SOFTPUB.DLL /S
  251. REGSVR32 WINTRUST.DLL /S
  252. REGSVR32 INITPKI.DLL /S
  253. REGSVR32 URLMON.DLL /S
  254. REGSVR32 DSSENH.DLL /S
  255. REGSVR32 MSXML.DLL /S
  256. REGSVR32 MSXML2.DLL /S
  257. REGSVR32 MSXML3.DLL /S
  258. REGSVR32 RSAENH.DLL /S
  259. REGSVR32 GPKCSP.DLL /S
  260. REGSVR32 SCCBASE.DLL /S
  261. REGSVR32 SLBCSP.DLL /S
  262. REGSVR32 CRYPTDLG.DLL /S
  263. REGSVR32 MSSIP32.DLL /S
  264. Cls
  265.  
  266.    
  267. Color 0A
  268.  
  269. Echo.
  270. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  271. Echo.
  272. Echo.
  273. Echo                                PLEASE WAIT...
  274.  
  275. Echo :: Reset Winsock Catalog to a clean state. >>%TMP%\WinUpResetLog.txt
  276.     Netsh Winsock Reset 2>>%TMP%\WinUpResetLog.txt
  277.  
  278. Cls
  279. Echo :: Resets portproxy configuration state. >>%TMP%\WinUpResetLog.txt
  280.    Netsh int portproxy reset 2>>%TMP%\WinUpResetLog.txt
  281.  
  282. Cls
  283. Echo :: Reset the IP HTTPS configurations. >>%TMP%\WinUpResetLog.txt
  284. Netsh int httpstunnel reset 2>>%TMP%\WinUpResetLog.txt
  285.  
  286.  
  287.  
  288. Cls
  289. Echo.
  290. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  291. Echo.
  292. Echo.
  293. Echo                                PLEASE WAIT...
  294.  
  295. Echo :: Run Next command for Windows Vista and later versions of Windows OS's. >>%TMP%\WinUpResetLog.txt
  296. For /f "tokens=2 delims=[]" %%a in ('ver') do (set Version=%%a)
  297. Set Version=%Version:~8,2%
  298. If Not %Version%==5 (
  299.  
  300. Echo :: Below command executed for Windows Vista and later versions of Windows OS. >>%TMP%\WinUpResetLog.txt
  301. Echo :: Cancels all jobs in the transfer queue that the all users owns.. >>%TMP%\WinUpResetLog.txt
  302.     Bitsadmin.exe /reset /allusers 2>>%TMP%\WinUpResetLog.txt
  303.     Ipconfig /flushdns 2>>%TMP%\WinUpResetLog.txt
  304.     Cls
  305.  
  306. Echo :: If you are running versions of Windows OS other then Windows XP OS type below Netsh command to reset proxy settings. >>%TMP%\WinUpResetLog.txt
  307.     Netsh Winhttp Reset Proxy 2>>%TMP%\WinUpResetLog.txt
  308. )
  309.  
  310.  
  311.  
  312.  
  313. Cls
  314. Echo.
  315. Echo                      RESETING WINDOWS UPDATE COMPONENTS
  316. Echo.
  317. Echo.
  318. Echo                                PLEASE WAIT...
  319.  
  320. Echo :: Restart the BITS service, the Windows Update service, and the Cryptographic service. >>%TMP%\WinUpResetLog.txt
  321.     Net start bits         2>>%TMP%\WinUpResetLog.txt
  322.     Net start wuauserv     2>>%TMP%\WinUpResetLog.txt
  323.     Net start appidsvc     2>>%TMP%\WinUpResetLog.txt
  324.     Net start cryptsvc     2>>%TMP%\WinUpResetLog.txt
  325.     Net start EventSystem  2>>%TMP%\WinUpResetLog.txt
  326.     Net start RpcLocator   2>>%TMP%\WinUpResetLog.txt
  327.     Net start RpcSs        2>>%TMP%\WinUpResetLog.txt
  328.     Net start RpcEptMapper 2>>%TMP%\WinUpResetLog.txt
  329.     Net start DcomLaunch   2>>%TMP%\WinUpResetLog.txt
  330.     Sc config BITS start= Auto         2>>%TMP%\WinUpResetLog.txt
  331.     Sc config wuauserv start= Auto     2>>%TMP%\WinUpResetLog.txt
  332.     Sc config AppIDSvc start= demand   2>>%TMP%\WinUpResetLog.txt
  333.     Sc config cryptsvc start= Auto     2>>%TMP%\WinUpResetLog.txt
  334.     Sc config EventSystem start= Auto  2>>%TMP%\WinUpResetLog.txt
  335.     Sc config RpcLocator start= demand 2>>%TMP%\WinUpResetLog.txt
  336.    
  337. :: Check version of the Windows OS.
  338. Reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName | find /i "Windows XP" >Nul
  339. If Not Errorlevel 1 Goto :Reboot
  340.    
  341. Echo :: Rebooting >>%TMP%\WinUpResetLog.txt
  342. Mode CON  LINES=5 COLS=48
  343. Cls
  344. Echo.
  345. Echo.
  346. Echo.
  347. Echo.
  348. Echo              DO YOU WANT TO REBOOT
  349. Echo.
  350. Echo.
  351.                              
  352.  
  353. Cd %~dp0
  354.  
  355. Echo :: Copying %TMP%\WinUpResetLog.txt to %UserProfile%\Desktop folder. >>%TMP%\WinUpResetLog.txt
  356. If Exist %TMP%\WinUpResetLog.txt Copy %TMP%\WinUpResetLog.txt %UserProfile%\Desktop 2>>%TMP%\WinUpResetLog.txt
  357. If Exist %TMP%\WinUpResetLog.txt Del %TMP%\WinUpResetLog.txt
  358. Goto :Reboot
  359.  
  360.  
  361. :IsAdmin
  362. Reg query "HKU\S-1-5-19\Environment"
  363. If Not %ERRORLEVEL% EQU 0 (
  364.  Cls & Mode CON  LINES=5 COLS=48 & Color 0C & Title - WARNING -
  365.  Echo.
  366.  Echo.
  367.  Echo  YOU MUST HAVE ADMINISTRATOR RIGHTS TO CONTINUE
  368.  Pause >Nul & Exit
  369. )
  370. Cls
  371. Goto :EOF
  372.  
  373. :Reboot
  374. Cls & Mode CON  LINES=11 COLS=42 & Color 0E & Title FreeBooter
  375. Echo.
  376. Echo.
  377. Echo    THIS COMPUTER WILL REBOOT
  378. Echo.
  379. Echo.
  380. Echo    PLEASE SAVE ALL WORK IN PROGRESS
  381. Echo.
  382. Echo.
  383. Echo    PRESS 'ENTER' KEY TO RESTART COMPUTER
  384. Pause >Nul
  385.  
  386. Shutdown  -r  -t 0  -c "REBOOTING SYSTEM" 2>&1 > Nul
  387.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement