Posted on June 6, 2016 · Posted in Windows 7

Reset Windows Update Agent and Service to Default

In this article we’ll show how to restore Windows Update agent and service to default state by resetting their configuration. As a rule, it is the most effective and the easiest way to solve the issue with Windows Update agent.

Usually Windows Update is debugged by analyzing logs in %windir%\WindowsUpdate.log (in Windows 10, you can get WindowsUpdate.log in this way). The number of possible errors an administrator can face during the analysis runs into dozens. To avoid undue efforts and waste no time, it’s much easier to completely reset Windows Update service and agent to the default state.

Windows Update error

The process of resetting Windows Update service and agent configuration consists of several steps. All the described operations can be done automatically using command prompt tools and are collected in a single script. (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 and Windows 10. 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 services (Windows Update), BITS and cryptographic services
    net stop bits
    net stop wuauserv
    net stop appidsvc
    net stop cryptsvc
  • Delete service files qmgr*.dat from %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 services are restarted the folders will be automatically created again
    Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
    Ren %systemroot%\system32\catroot2 catroot2.bak
  • Delete the old log file windowsupdate.log
    del /f /s /q %windir%\windowsupdate.log
  • Reset the permissions for BITS and Windows Update (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)
  • 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
  • Reset Winsock settingsnetsh 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 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate branch
    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

  • Start the previously stopped services
    net start bits
    net start wuauserv
    net start appidsvc
    net start cryptsvc
  • Optional. In some cases you’ll need to install/reinstall the latest version of Windows Update Agent (WUA). You can download it on this webpage https://support.microsoft.com/en-us/kb/949104. Download the file for your Windows version. Download latest  windows update agentThe latest version of WUA for Windows 7 SP1 x64 is 7.6. Forced reinstallation can be started using these commands: for x32 Windows 7 versions WindowsUpdateAgent-7.6-x86.exe /quiet /norestart /wuforce for x64 Windows 7 versionsWindowsUpdateAgent-7.6-x64.exe /quiet /norestart /wuforce

Tip. The current Windows Update Agent (WUA) version can be obtained in %windir%\system32\Wuaueng.dll properties. In our example, it is 7.6.7600.256 (the latest one).Wuaueng.dll version

Now you only have to restart your computer and run synchronization with Windows Update server / WSUS.reset windows update script: run as admin

wuauclt /resetauthorization /detectnow

Then start Windows Update and make sure that there are no errors while searching, downloading and installing the updates.

The script reset_windows_update_agent.bat can be downloaded following this link reset_windows_update_agent.zip (items 9 and 11 are not included in the script since they are optional). Download the script, unzip it and run with the administrator privileges.

 

The full code of reset_windows_update_agent.bat:

@echo off
REM Script to Reset Windows Updates agent
REM Stop Services
net stop bits
net stop wuauserv
net stop appidsvc
net stop cryptsvc
REM Delete the qmgr*.dat files
Del «%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat»
REM Rename folders
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak
REM Reset services permissions
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)
REM ReRegister services
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
REM reset winsock
netsh winsock reset
REM reset proxy
netsh winhttp reset proxy
REM restart services
net start bits
net start wuauserv
net start appidsvc
net start cryptsvc
REM Install the latest Windows Update Agent.
start http://support.microsoft.com/kb/949104

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

Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak

Previous:
Next:
Related Articles