How to:Reset Windows update components in Windows

Technical Level: Intermediate

Summary

Windows update is an Important component of Windows. By Windows updates one can get

  • new drivers for the hardware devices installed in the computer
  • security patches
  • Known bugs fixed
  • Major updates and upgrades.

But some issues, generally related directly or indirectly to some corruption in system files, windows update may not work properly. This article discusses resetting the Windows update completely using a reset script.

Details

The script does the following things:
  • Removes the older Windows update Folders, where the updates are downloaded. Newer ones are created automatically.
  • Re-registers the Windows update Files.
  • Resets your network connection.

Instructions for usage:

  1. Download the Script into your computer.
  2. At the location where it is saved, Right click and select Extract.
  1. After the extract is complete, you will see a WuReset.bat named File in the new windows that opens.
  2. Right click WuReset.bat named file and select Run as administrator.
  1. Wait for the “Task completed successfully” message in the command Prompt Window.
  2. Restart your computer and check for the updates again.
Download the Reset Script For Users running Windows 10 build 10240 and later:

Download Windows update Reset script for Windows 7 and 8

In  any case, if you cannot download/run the script, copy the following code in notepad and save it by "WUReset.bat" (with quotes) and then run it subsequently:

@echo off echo .

echo Simple script to reset windows update-Credits to shawn Brink for the commands

echo .

echo PAUSE set b=0 :bits set /a b=%b%+1 if %b% equ 3 ( goto end1 ) net stop bits echo Checking the bits service status. sc query bits | findstr /I /C:"STOPPED" if not %errorlevel%==0 ( goto bits ) goto loop2 :end1 cls echo. echo Failed to reset Windows Update due to bits service failing to stop. echo. pause goto Start :loop2 set w=0 :wuauserv set /a w=%w%+1 if %w% equ 3 ( goto end2 ) net stop wuauserv echo Checking the wuauserv service status. sc query wuauserv | findstr /I /C:"STOPPED" if not %errorlevel%==0 ( goto wuauserv ) goto loop3 :end2 cls echo. echo Failed to reset Windows Update due to wuauserv service failing to stop. echo. pause goto Start :loop3 set app=0 :appidsvc set /a app=%app%+1 if %app% equ 3 ( goto end3 ) net stop appidsvc echo Checking the appidsvc service status. sc query appidsvc | findstr /I /C:"STOPPED" if not %errorlevel%==0 ( goto appidsvc ) goto loop4 :end3 cls echo. echo Failed to reset Windows Update due to appidsvc service failing to stop. echo. pause goto Start :loop4 set c=0 :cryptsvc set /a c=%c%+1 if %c% equ 3 ( goto end4 ) net stop cryptsvc echo Checking the cryptsvc service status. sc query cryptsvc | findstr /I /C:"STOPPED" if not %errorlevel%==0 ( goto cryptsvc ) goto Reset :end4 cls echo. echo Failed to reset Windows Update due to cryptsvc service failing to stop. echo. pause goto Start :Reset Ipconfig /flushdns del /s /q /f "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"

del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat" cd /d %windir%\system32 if exist "%SYSTEMROOT%\winsxs\pending.xml.bak" del /s /q /f "%SYSTEMROOT%\winsxs\pending.xml.bak" if exist "%SYSTEMROOT%\winsxs\pending.xml" ( takeown /f "%SYSTEMROOT%\winsxs\pending.xml" attrib -r -s -h /s /d "%SYSTEMROOT%\winsxs\pending.xml" ren "%SYSTEMROOT%\winsxs\pending.xml" pending.xml.bak ) if exist "%SYSTEMROOT%\SoftwareDistribution.bak" rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution.bak" if exist "%SYSTEMROOT%\SoftwareDistribution" ( attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution" ren "%SYSTEMROOT%\SoftwareDistribution" SoftwareDistribution.bak ) if exist "%SYSTEMROOT%\system32\Catroot2.bak" rmdir /s /q "%SYSTEMROOT%\system32\Catroot2.bak" if exist "%SYSTEMROOT%\system32\Catroot2" ( attrib -r -s -h /s /d "%SYSTEMROOT%\system32\Catroot2" ren "%SYSTEMROOT%\system32\Catroot2" Catroot2.bak ) if exist "%SYSTEMROOT%\WindowsUpdate.log.bak" del /s /q /f "%SYSTEMROOT%\WindowsUpdate.log.bak" if exist "%SYSTEMROOT%\WindowsUpdate.log" ( attrib -r -s -h /s /d "%SYSTEMROOT%\WindowsUpdate.log" ren "%SYSTEMROOT%\WindowsUpdate.log" WindowsUpdate.log.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) 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 regsvr32 /s wudriver.dll netsh winsock reset netsh winsock reset proxy :Start net start bits net start wuauserv net start appidsvc net start cryptsvc

echo Task completed succesfully!Please restart your computer and check for the updates again.

Is this Script Safe?

Yes, the script is absolutely safe to use. The code is created with the help of Shawn Brink, who is an MVP of Microsoft. You can look into the source by right-clicking the bat file and selecting edit.

Special thanks to  Askvg and Tenforums and Denis for the help

Also Read:

Fix Windows update undoing changes

 

Forum Article Info


Last updated November 15, 2019 Views 57,753 Applies to:

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

Sumit,

I have tested an amended form of the batch file. It now does what I expected it to do. I suggest amending the batch file to include the additional line

del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat"

I cannot know how many users have this alternative qmgr location. All I know is that both mine do & neither of them has the qmgr location given in the original batch file.  I clean installed Windows 10 on both computers during August.

At the risk of boring you:-
1 The reason I thought something needed to be investigated was that, after running the original batch file [and the many similar ones such as the TechNet version], then manually running Settings, Updates it searched for updates even though it was not connected to the internet or to any other computers and produced results [a list of updates to be downloaded - the listed updates were those that had been found during a previous update search]. So I concluded that the previous queue had not been cleaned out by the batch file.
2 After running an amended batch file that deleted the qmgr files in the alternative location, running Settings, Updates resulted in an almost immediate response that it couldn't connect to the update services [no list of updates was displayed]. This new behaviour makes sense because the computer was still not connected to the internet or any other computers.
So, the amended batch file successfully reset Windows update, including the update queue, whereas the original batch file did not.

The subject is of particular significance to me because I use a metered internet connection and I sometimes run Windows update to see if there is anything large enough to warrant going to the free & fast WiFi in my local library. I need to reset the update queue so that I can run Windows update from a clean start - otherwise it would continue with the existing list of updates and only afterwards would it bother to search for new ones [new ones that might supercede those that I have just wasted my time downloading & installing].

Denis
Try*3 - a user
Dell Inspirons 7779, 1545, 9300; Windows 10 Home x64 & Pro x86; Office Pro 2007; HP DJ2540; HTC UPlay [Android 6.0], MyPhoneExplorer
Thanks. I ll do a bit of research this weekend on this and would let you know how testing the ammended script goes on both of my systems.
Sumit
Windows Insider MVP 2018-2020 and Volunteer Moderator

Dell Inspiron 5590 - i5 10210U/12GB DDR4/ 4GB Nvidia MX230/ 512GB nvme

Sumit,

By the way, TenForums have now included the extra line in their version of the batch file.

Denis

Try*3 - a user
Dell Inspirons 7779, 1545, 9300; Windows 10 Home x64 & Pro x86; Office Pro 2007; HP DJ2540; HTC UPlay [Android 6.0], MyPhoneExplorer

Sumit,

Just to keep you up to date, the TechNet script [upon which the TenForums batch file was based] has now also added the extra line.

Denis

Try*3 - a user
Dell Inspirons 7779, 1545, 9300; Windows 10 Home x64 & Pro x86; Office Pro 2007; HP DJ2540; HTC UPlay [Android 6.0], MyPhoneExplorer

Hi Denis,

Thank you for the noticing this one. As you said, I see that both of the locations- the one you mentioned and the old one do contain qmgr files. I do not know when this happened, but I have updated the script.

Again thanks for your collaboration.

Sumit
Windows Insider MVP 2018-2020 and Volunteer Moderator

Dell Inspiron 5590 - i5 10210U/12GB DDR4/ 4GB Nvidia MX230/ 512GB nvme
the downloadable batch file is 65 lines an is 2k  . the batch file offered as copy the following code has 190 lines and is 5k is there a difference or does all the blank space in the bigger file inconsequential ? 

Hello Sumit,

This is what happens to me if I attempt to run this file. Kindly help since Win10 Cummulative Update KB4015438 has failed to install since 24/3.

Thanks.

thanks mic
      Followed instructions to the letter. Fixed all problems and works as advertised. Thank you very much for the help!

I ran this on my computer in order to fix update issue KB4015438 failing to install. Was having problems with my Wi-Fi disconnecting at will. I am not a geek, I am learning as I go.  Now when I restart I get an error on initializing 0x80070005. Defender shows same code when I click on it.

Have I made a terrible rookie mistake in running this program? Please help!

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.