Reset Windows Update
Updates stuck or repeatedly failing? This batch script resets several Windows Update components so you can restart your PC and try again. Try the Windows Update troubleshooter first; use this reset when simpler troubleshooting has not helped.
Script type: Windows batch (.bat) · Run as: Administrator · Restart required: Yes
Before you start
Save your work and let any active update installation finish. On a work-managed device, check with your IT team before changing update or network settings.
It stops and starts Windows Update, Cryptographic Services, BITS and Windows Installer; renames the update cache folders; resets BITS and Windows Update service permissions; resets Winsock and the WinHTTP proxy; and attempts to re-register DLLs.
The permission resets replace custom service permissions. The proxy reset removes the configured WinHTTP proxy, which may be needed on your network. Record any custom settings before running this script. See Microsoft’s Windows Update reset guidance.
Get the script
Use Copy code to put the whole script on your clipboard, or Download .bat to save the file. The preview below shows exactly what is in the download.
Read through the script before running it on your PC.
@echo off
:: ============================================================
:: Reset Windows Update components
:: Run this file as Administrator (right-click -> Run as administrator)
:: ============================================================
echo.
echo Stopping Windows Update related services...
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver
echo.
echo Renaming SoftwareDistribution and Catroot2 folders...
if exist "%windir%\SoftwareDistribution" (
ren "%windir%\SoftwareDistribution" "SoftwareDistribution.old"
)
if exist "%windir%\System32\catroot2" (
ren "%windir%\System32\catroot2" "catroot2.old"
)
echo.
echo Resetting BITS and Windows Update services security descriptors...
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)
echo.
echo Resetting Winsock and network settings related to updates...
netsh winsock reset
netsh winhttp reset proxy
echo.
echo Re-registering Windows Update related DLLs...
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.
echo Starting Windows Update related services again...
net start wuauserv
net start cryptSvc
net start bits
net start msiserver
echo.
echo ============================================================
echo Done. Please reboot your PC, then try Windows Update again.
echo (Settings ^> Windows Update ^> Check for updates)
echo ============================================================
echo.
pause
Run it step by step
- If you copied the code, open Notepad and paste it into a new file.
- Choose File → Save As, set Save as type to All files, and name it
reset-windows-update.bat. Make sure it does not end in.bat.txt. If you downloaded the file, you can skip these two steps. - Right-click the saved
.batfile and choose Run as administrator. Approve the Windows permission prompt. - Read the messages in the command window. The script pauses at the end so you can review them before closing it.
- Restart your PC, then open Settings → Windows Update → Check for updates.
This is the supplied script, unchanged. It continues after command failures, and DLL registration uses silent mode. Some listed DLLs may be absent on newer Windows versions. If a .old folder already exists, its rename can fail; do not assume a second run has reset the cache successfully.
Check the result
Try the update that was failing and confirm it installs successfully. If it still fails, note the exact error code and any service or folder errors from the script. Those details are more useful for the next troubleshooting step than repeatedly running the reset.
This script has been reviewed for presentation here; it has not been executed or validated on a Windows test machine.