Windows

Resetting Windows Update Agent Settings

By August 14, 2019 No Comments

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 error

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.

fix windows update errors with the wu10.diagcab
windows update troubleshooting tools - fix wndows update database corruption

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 below).

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:

  1. Stop Windows Update , BITS and cryptographic services:
    net stop bits
    net stop wuauserv
    net stop appidsvc
    net stop cryptsvc
    taskkill /im wuauclt.exe /f
  2. Delete service files qmgr*.dat from the folder %ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\:
    Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
  3. 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
    Ren %systemroot%\system32\catroot2 catroot2.bak
  4. Delete the old windowsupdate.log file :
    del /f /s /q %windir%\windowsupdate.log
  5. 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)
    sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
    sc.exe sdset cryptsvc D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
    sc.exe sdset trustedinstaller D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
  6. Re-register the files of system dynamic libraries (dll) related to BITS and Windows Update:
    cd /d %windir%\system32
    regsvr32.exe /U /s vbscript.dll
    regsvr32.exe /U /s mshtml.dll
    regsvr32.exe /U /s msjava.dll
    regsvr32.exe /U /s msxml.dll
    regsvr32.exe /U /s actxprxy.dll
    regsvr32.exe /U /s shdocvw.dll
    regsvr32.exe /U /s Mssip32.dll
    regsvr32.exe /U /s wintrust.dll
    regsvr32.exe /U /s initpki.dll
    regsvr32.exe /U /s dssenh.dll
    regsvr32.exe /U /s rsaenh.dll
    regsvr32.exe /U /s gpkcsp.dll
    regsvr32.exe /U /s sccbase.dll
    regsvr32.exe /U /s slbcsp.dll
    regsvr32.exe /U /s cryptdlg.dll
    regsvr32.exe /U /s Urlmon.dll
    regsvr32.exe /U /s Oleaut32.dll
    regsvr32.exe /U /s msxml2.dll
    regsvr32.exe /U /s Browseui.dll
    regsvr32.exe /U /s shell32.dll
    regsvr32.exe /U /s atl.dll
    regsvr32.exe /U /s jscript.dll
    regsvr32.exe /U /s msxml3.dll
    regsvr32.exe /U /s softpub.dll
    regsvr32.exe /U /s wuapi.dll
    regsvr32.exe /U /s wuaueng.dll
    regsvr32.exe /U /s wuaueng1.dll
    regsvr32.exe /U /s wucltui.dll
    regsvr32.exe /U /s wups.dll
    regsvr32.exe /U /s wups2.dll
    regsvr32.exe /U /s wuweb.dll
    regsvr32.exe /U /s scrrun.dll
    regsvr32.exe /U /s msxml6.dll
    regsvr32.exe /U /s ole32.dll
    regsvr32.exe /U /s qmgr.dll
    regsvr32.exe /U /s qmgrprxy.dll
    regsvr32.exe /U /s wucltux.dll
    regsvr32.exe /U /s muweb.dll
    regsvr32.exe /U /s wuwebv.dll
    regsvr32.exe /s vbscript.dll
    regsvr32.exe /s mshtml.dll
    regsvr32.exe /s msjava.dll
    regsvr32.exe /s msxml.dll
    regsvr32.exe /s actxprxy.dll
    regsvr32.exe /s shdocvw.dll
    regsvr32.exe /s Mssip32.dll
    regsvr32.exe /s wintrust.dll
    regsvr32.exe /s initpki.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 Urlmon.dll
    regsvr32.exe /s Oleaut32.dll
    regsvr32.exe /s msxml2.dll
    regsvr32.exe /s Browseui.dll
    regsvr32.exe /s shell32.dll
    regsvr32.exe /s Mssip32.dll
    regsvr32.exe /s atl.dll
    regsvr32.exe /s jscript.dll
    regsvr32.exe /s msxml3.dll
    regsvr32.exe /s softpub.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 scrrun.dll
    regsvr32.exe /s msxml6.dll
    regsvr32.exe /s ole32.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
  7. Reset Winsock settings:
    netsh winsock reset
  8. Reset system proxy settings:
    netsh winhttp reset proxy
  9. 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
    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\Policies\Microsoft\Windows\WindowsUpdate" /v TargetGroup /f
    REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /f
    REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /f
  10. Start the previously stopped services:

    sc.exe config wuauserv start= auto
    sc.exe config bits start= delayed-auto
    sc.exe config cryptsvc start= auto
    sc.exe config TrustedInstaller start= demand
    sc.exe config DcomLaunch start= auto
    net start bits
    net start wuauserv
    net start appidsvc
    net start cryptsvc
  11. 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

Tip. The current Windows Update Agent (WUA) version on your computer can be found in the properties of the %windir%\system32\Wuaueng.dll file. In our example, it is 7.6.7600.256.

Wuaueng.dll version

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.

reset windows update script: run as admin

If the updates are downloaded and installed correctly, you can remove the backups:

Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
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.

  1. Download the ResetWUEng.zip archive here (https://gallery.technet.microsoft.com/scriptcenter/Reset-Windows-Update-Agent-d824badc) and unpack it;
  2. Run the ResetWUEng.cmd file with the administrator permissions;
  3. 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.);
  4. To reset the Windows Update settings, it is usually sufficient to use the option 2 – Resets the Windows Update Components. Press 2 and Enter;
  5. 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 action does by opening the ResetWUEng.cmd file in any text editor and examining its contents. For example, option 2 sends you to the :components function. 
  6. After the completion of the Reset Windows Update Agent script, restart your computer and run scan for new updates.

Leave a Reply