Every now and then, you may discover a computer system that is unable to detect or install available software updates from Microsoft or from your internal Windows Server Update Services (WSUS) repository. You’ll find an error such as 8007000E generated and often times running the Windows Update Troubleshooter FixIt tool is sufficient to fix Windows Update errors, but sometimes a manual approach that requires the deletion of the SoftwareDistribution content and re-registering the Windows Update components is needed, and this can be a tedious task. By using a script, this repair task can be automated.
Here are some batch scripts to help fix a broken Windows Update Agent on a computer system. The scripts can also be run on a remote system using the ‘psexec‘ tool, which is part of the Sysinternals Suite from Microsoft. Copy and paste the content of your desired batch file below into Notepad and save the file with the “.bat” file extension, for example: repair_wua.bat .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
Echo This batch file will Force the Update Detection from the AU client: @echo on net stop wuauserv /y net stop bits /y rmdir c:\windows\SoftwareDistribution /S /Q del C:\Windows\WindowsUpdate.log /S /Q REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f Reg Delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f Reg Delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientValidation /f REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v LastWaitTimeout /f REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v DetectionStartTime /f Reg Delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v NextDetectionTime /f echo re-registering Windows Update components.. regsvr32.exe c:\windows\system32\wuapi.dll /s regsvr32.exe c:\windows\system32\wups.dll /s regsvr32.exe c:\windows\system32\wuaueng.dll /s regsvr32.exe c:\windows\system32\wucltui.dll /s regsvr32.exe c:\windows\system32\msxml3.dll /s regsvr32.exe c:\windows\system32\wuaueng1.dll /s regsvr32.exe c:\windows\system32\wups2.dll /s regsvr32.exe c:\windows\system32\wuweb.dll /s net start wuauserv /y net start bits /y echo Initiating Windows Updates detection cycle... wuauclt.exe /resetauthorization wuauclt.exe /detectnow wuauclt.exe /reportnow @echo off |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
@ECHO OFF net stop bits net stop wuauserv net stop appidsvc net stop cryptsvc Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" Ren %systemroot%\Windowsupdate.log Windowsupdate.bak Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak Ren %systemroot%\system32\catroot2 catroot2.bak sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) cd /d %windir%\system32 regsvr32.exe /s actxprxy.dll regsvr32.exe /s atl.dll regsvr32.exe /s browseui.dll regsvr32.exe /s cryptdlg.dll regsvr32.exe /s dssenh.dll regsvr32.exe /s gpkcsp.dll regsvr32.exe /s initpki.dll regsvr32.exe /s jscript.dll regsvr32.exe /s mshtml.dll regsvr32.exe /s msxml.dll regsvr32.exe /s msxml3.dll regsvr32.exe /s msxml6.dll regsvr32.exe /s muweb.dll regsvr32.exe /s ole32.dll regsvr32.exe /s oleaut32.dll regsvr32.exe /s qmgr.dll regsvr32.exe /s qmgrprxy.dll regsvr32.exe /s rsaenh.dll regsvr32.exe /s sccbase.dll regsvr32.exe /s scrrun.dll regsvr32.exe /s shdocvw.dll regsvr32.exe /s shell32.dll regsvr32.exe /s slbcsp.dll regsvr32.exe /s softpub.dll regsvr32.exe /s softpub.dll regsvr32.exe /s urlmon.dll regsvr32.exe /s vbscript.dll regsvr32.exe /s wintrust.dll regsvr32.exe /s wuapi.dll regsvr32.exe /s wuaueng.dll regsvr32.exe /s wuaueng1.dll regsvr32.exe /s wucltui.dll regsvr32.exe /s wucltux.dll regsvr32.exe /s wups.dll regsvr32.exe /s wups2.dll regsvr32.exe /s wuweb.dll regsvr32.exe /s wuwebv.dll netsh winsock reset netsh winhttp reset proxy net start bits net start wuauserv net start appidsvc net start cryptsvc wuauclt /resetauthorization /detectnow exit |
Here’s another Windows Update Agent Reset script available on Technet.
The Windows Update Troubleshooter is available here.
Follow me on Twitter (@Hoorge) and join Tech Konnect on Facebook to stay current on technology related matters.