This script is to be used to repair the Windows Update Agent. Note, you must run it as admin or deploy in the System Account.
@echo off title Reset Windows Update Agent cls color 0a echo Stopping Windows Update services… ping -n 4 127.0.0.1>nul net stop wuauserv net stop bits net stop appidsvc net stop cryptsvc net stop ccmexec echo Success! echo. ping -n 4 127.0.0.1>nul echo Checking services… ping -n 4 127.0.0.1>nul sc query wuauserv | findstr /I /C:”STOPPED” if %errorlevel% NEQ 0 goto END sc query bits | findstr /I /C:”STOPPED” if %errorlevel% NEQ 0 goto END sc query appidsvc | findstr /I /C:”STOPPED” if %errorlevel% NEQ 0 sc query appidsvc | findstr /I /C:”OpenService FAILED 1060? if %errorlevel% NEQ 0 goto END sc query cryptsvc | findstr /I /C:”STOPPED” if %errorlevel% NEQ 0 goto END sc query ccmexec | findstr /I /C:”STOPPED” if %errorlevel% NEQ 0 sc query ccmexec | findstr /I /C:”OpenService FAILED 1060? if %errorlevel% NEQ 0 goto END echo Success! echo. ping -n 4 127.0.0.1>nul echo Deleting AU cache folder and log file… ping -n 4 127.0.0.1>nul del /f /q “%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat” del /f /s /q %SystemRoot%\SoftwareDistribution\*.* del /f /s /q %SystemRoot%\system32\catroot2\*.* del /f /q %SystemRoot%\WindowsUpdate.log Data\Microsoft\Network\Downloader\qmgr*.dat” echo Success! echo. ping -n 4 127.0.0.1>nul echo Re-registering DLL files… ping -n 4 127.0.0.1>nul cd /d %WinDir%\system32 regsvr32.exe /s atl.dll regsvr32.exe /s urlmon.dll regsvr32.exe /s mshtml.dll regsvr32.exe /s shdocvw.dll regsvr32.exe /s browseui.dll regsvr32.exe /s jscript.dll regsvr32.exe /s vbscript.dll regsvr32.exe /s scrrun.dll regsvr32.exe /s msxml.dll regsvr32.exe /s msxml3.dll regsvr32.exe /s msxml6.dll regsvr32.exe /s actxprxy.dll regsvr32.exe /s softpub.dll regsvr32.exe /s wintrust.dll regsvr32.exe /s dssenh.dll regsvr32.exe /s rsaenh.dll regsvr32.exe /s gpkcsp.dll regsvr32.exe /s sccbase.dll regsvr32.exe /s slbcsp.dll regsvr32.exe /s cryptdlg.dll regsvr32.exe /s oleaut32.dll regsvr32.exe /s ole32.dll regsvr32.exe /s shell32.dll regsvr32.exe /s initpki.dll regsvr32.exe /s wuapi.dll regsvr32.exe /s wuaueng.dll regsvr32.exe /s wuaueng1.dll regsvr32.exe /s wucltui.dll regsvr32.exe /s wups.dll regsvr32.exe /s wups2.dll regsvr32.exe /s wuweb.dll regsvr32.exe /s qmgr.dll regsvr32.exe /s qmgrprxy.dll regsvr32.exe /s wucltux.dll regsvr32.exe /s muweb.dll regsvr32.exe /s wuwebv.dll echo Success! echo. ping -n 4 127.0.0.1>nul echo Removing WSUS Client ID… ping -n 4 127.0.0.1>nul 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 echo Success! echo. ping -n 4 127.0.0.1>nul echo Resetting Winsock and WinHTTP Proxy… ping -n 4 127.0.0.1>nul netsh winsock reset proxycfg.exe -d netsh winhttp reset proxy echo Success! echo. ping -n 4 127.0.0.1>nul echo Starting services… ping -n 4 127.0.0.1>nul net start ccmexec net start cryptsvc net start appidsvc net start bits net start wuauserv echo Success! echo. ping -n 4 127.0.0.1>nul echo Deleting all BITS jobs… ping -n 4 127.0.0.1>nul bitsadmin.exe /reset /allusers echo Success! echo. ping -n 4 127.0.0.1>nul echo Forcing AU discovery… ping -n 4 127.0.0.1>nul wuauclt /resetauthorization /detectnow echo Success! echo. ping -n 4 127.0.0.1>nul :END echo Windows Update Agent has been reset! pause exit /b 0