Resetting Windows Update Agent Settings
In this article we’ll show how to fix common Windows Update errors by resetting Windows Update components configuration. As a rule, it is the most effective and the easiest way to solve the issues with the Windows Update service if updates are not downloaded or errors occur when installing updates.
Usually, to debug Windows Update errors, an administrator needs to analyze the error codes in the log file %windir%\WindowsUpdate.log (in Windows 10, you can get WindowsUpdate.log in this way). The number of possible errors that an administrator may encounter when analyzing the Windows update log is dozens (a complete list of Windows Update errors) and the process of resolving them is non-trivial. To avoid undue efforts and waste no time, it’s much easier to completely reset Windows Update service and agent to the default state. After resetting Windows Update, you can try to check for updates.
Windows Update Troubleshooter Tool
Before proceeding to reset the configuration of Windows Update, we strongly recommend that you first try a simpler and more effective tool to automatically fix problems in the Windows Update service with the help of Windows Update Troubleshooter Tool.
Download and run the Windows Update Troubleshooter for your Windows version:
- Windows 10 – wu10.diagcab (https://aka.ms/wudiag) (or run the local version of the tool: Start -> Settings -> Updates and Security -> Troubleshoot -> Windows Updates Troubleshooter);
- Windows 7 and Windows 8.1 — WindowsUpdate.diagcab (https://aka.ms/diag_wu).
Wait for the Windows Update Troubleshooter to scan your system and automatically attempt to fix all errors in the Windows Update and related components.
In my case, a corruption in the Windows Update database was found and fixed. After that, it remains to restart the computer and try to scan for updates. If updates are not downloaded or installed, proceed to the next step.
Reset Windows Update Settings from the Command Line
The process of resetting Windows Update service and agent configuration consists of several steps. All the described operations are performed in the elevated command prompt. I added all the commands in a single bat file (to download the ready script, follow the link).
Using this script, you can completely reset the configuration of Windows Update and clear the local update cache. The script is applicable for Windows 7, Windows 8.1, Windows 10 and Windows Server 2016/2012 R2/2008 R2. This script helps to eliminate the majority of typical Windows Update errors, when Windows Update stops downloading new updates or errors appear during update installation.
Let’s consider what this script does step by step:
- Stop Windows Update , BITS and cryptographic services:
net stop bits<br />net stop wuauserv<br />net stop appidsvc<br />net stop cryptsvc<br />taskkill /im wuauclt.exe /f<br />
- Delete service files qmgr*.dat from the folder %ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\:
Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
- Rename system folders, in which configuration files and update cache are stored (if necessary, they can be used as backups). After the WU services are restarted the folders will be automatically created again:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak<br />Ren %systemroot%\system32\catroot2 catroot2.bak
- Delete the old windowsupdate.log file :
del /f /s /q %windir%\windowsupdate.log
- Reset the permissions for BITS and Windows Update services (if service permissions have been changed):
sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)<br />sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)<br />sc.exe sdset cryptsvc D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)<br />sc.exe sdset trustedinstaller D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)<br />
- Re-register the files of system dynamic libraries (dll) related to BITS and Windows Update:
cd /d %windir%\system32<br />regsvr32.exe /U /s vbscript.dll<br />regsvr32.exe /U /s mshtml.dll<br />regsvr32.exe /U /s msjava.dll<br />regsvr32.exe /U /s msxml.dll<br />regsvr32.exe /U /s actxprxy.dll<br />regsvr32.exe /U /s shdocvw.dll<br />regsvr32.exe /U /s Mssip32.dll<br />regsvr32.exe /U /s wintrust.dll<br />regsvr32.exe /U /s initpki.dll<br />regsvr32.exe /U /s dssenh.dll<br />regsvr32.exe /U /s rsaenh.dll<br />regsvr32.exe /U /s gpkcsp.dll<br />regsvr32.exe /U /s sccbase.dll<br />regsvr32.exe /U /s slbcsp.dll<br />regsvr32.exe /U /s cryptdlg.dll<br />regsvr32.exe /U /s Urlmon.dll<br />regsvr32.exe /U /s Oleaut32.dll<br />regsvr32.exe /U /s msxml2.dll<br />regsvr32.exe /U /s Browseui.dll<br />regsvr32.exe /U /s shell32.dll<br />regsvr32.exe /U /s atl.dll<br />regsvr32.exe /U /s jscript.dll<br />regsvr32.exe /U /s msxml3.dll<br />regsvr32.exe /U /s softpub.dll<br />regsvr32.exe /U /s wuapi.dll<br />regsvr32.exe /U /s wuaueng.dll<br />regsvr32.exe /U /s wuaueng1.dll<br />regsvr32.exe /U /s wucltui.dll<br />regsvr32.exe /U /s wups.dll<br />regsvr32.exe /U /s wups2.dll<br />regsvr32.exe /U /s wuweb.dll<br />regsvr32.exe /U /s scrrun.dll<br />regsvr32.exe /U /s msxml6.dll<br />regsvr32.exe /U /s ole32.dll<br />regsvr32.exe /U /s qmgr.dll<br />regsvr32.exe /U /s qmgrprxy.dll<br />regsvr32.exe /U /s wucltux.dll<br />regsvr32.exe /U /s muweb.dll<br />regsvr32.exe /U /s wuwebv.dll<br />regsvr32.exe /s vbscript.dll<br />regsvr32.exe /s mshtml.dll<br />regsvr32.exe /s msjava.dll<br />regsvr32.exe /s msxml.dll<br />regsvr32.exe /s actxprxy.dll<br />regsvr32.exe /s shdocvw.dll<br />regsvr32.exe /s Mssip32.dll<br />regsvr32.exe /s wintrust.dll<br />regsvr32.exe /s initpki.dll<br />regsvr32.exe /s dssenh.dll<br />regsvr32.exe /s rsaenh.dll<br />regsvr32.exe /s gpkcsp.dll<br />regsvr32.exe /s sccbase.dll<br />regsvr32.exe /s slbcsp.dll<br />regsvr32.exe /s cryptdlg.dll<br />regsvr32.exe /s Urlmon.dll<br />regsvr32.exe /s Oleaut32.dll<br />regsvr32.exe /s msxml2.dll<br />regsvr32.exe /s Browseui.dll<br />regsvr32.exe /s shell32.dll<br />regsvr32.exe /s Mssip32.dll<br />regsvr32.exe /s atl.dll<br />regsvr32.exe /s jscript.dll<br />regsvr32.exe /s msxml3.dll<br />regsvr32.exe /s softpub.dll<br />regsvr32.exe /s wuapi.dll<br />regsvr32.exe /s wuaueng.dll<br />regsvr32.exe /s wuaueng1.dll<br />regsvr32.exe /s wucltui.dll<br />regsvr32.exe /s wups.dll<br />regsvr32.exe /s wups2.dll<br />regsvr32.exe /s wuweb.dll<br />regsvr32.exe /s scrrun.dll<br />regsvr32.exe /s msxml6.dll<br />regsvr32.exe /s ole32.dll<br />regsvr32.exe /s qmgr.dll<br />regsvr32.exe /s qmgrprxy.dll<br />regsvr32.exe /s wucltux.dll<br />regsvr32.exe /s muweb.dll<br />regsvr32.exe /s wuwebv.dll
- Reset Winsock settings:
netsh winsock reset
- Reset system proxy settings:
netsh winhttp reset proxy
- Optional. When using a local WSUS server, you can also reset the current binding of a client to the WSUS server by deleting the following parameters in the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate:
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f<br />REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f<br />REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f<br />REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v TargetGroup /f<br />REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /f<br />REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /f
- Start the previously stopped services:
<br />sc.exe config wuauserv start= auto<br />sc.exe config bits start= delayed-auto<br />sc.exe config cryptsvc start= auto<br />sc.exe config TrustedInstaller start= demand<br />sc.exe config DcomLaunch start= auto<br />net start bits<br />net start wuauserv<br />net start appidsvc<br />net start cryptsvc
- Optional. In some cases you’ll need to install/reinstall the latest version of Windows Update Agent (WUA). You can download the current version of Windows Update agent from this webpage https://support.microsoft.com/en-us/kb/949104. Download the file for your Windows version. To force reinstall of the Windows Update Agent, run the following commands: for Windows 7 x86:
WindowsUpdateAgent-7.6-x86.exe /quiet /norestart /wuforce
, for Windows 7 x64:WindowsUpdateAgent-7.6-x64.exe /quiet /norestart /wuforce
Now you only have to restart your computer and run synchronization with Windows Update server / WSUS.
wuauclt /resetauthorization /detectnow
Then go to the Windows Update and make sure that there are no errors while checking, downloading and installing the updates.
The script reset_windows_update_agent.bat can be downloaded following this link reset_windows_update_agent.zip (options 9 and 11 are not included in the script since they are optional). Download the script, unzip it and run with the administrator privileges.
If the updates are downloaded and installed correctly, you can remove the backups:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak<br />Ren %systemroot%\system32\catroot2 catroot2.bak
Script Reset Windows Update Agent
In the Technet script gallery there is a rather useful and simple script to reset the Windows Update components – Reset Windows Update Agent Tool. The script is universal and suitable for all versions of Windows: starting with Windows XP and ending with the latest Windows 10 builds. Consider how to use it.
- Download the ResetWUEng.zip archive here (https://gallery.technet.microsoft.com/scriptcenter/Reset-Windows-Update-Agent-d824badc) and unpack it;
- Run the ResetWUEng.cmd file with the administrator permissions;
- The script will detect your OS version (in my example, it is Windows 10) and will offer 18 different options. Some of them do not directly related to the reset of WU agent settings, but may be useful for fixing various Windows issues (checking the disk with the chkdsk, fixing errors in the Windows image, resetting Winsock, clearing temporary files, etc.);
- To reset the Windows Update settings, it is usually sufficient to use the option 2 – Resets the Windows Update Components. Press 2 and Enter;
- The script will automatically perform all the actions that we described above when performing a manual reset of the Windows Update Agent from the command prompt;You can see the script performed actions by opening the ResetWUEng.cmd file in any text editor and examining its contents. For example, option 2 sends you to the :components function.
- After the completion of the Reset Windows Update Agent script, restart your computer and run scan for new updates.