Windows Update loops (getting stuck at “Undoing changes made to your computer” or error code loops like 0x80070002) are a common frustration. These occur when the local Windows Update database becomes corrupted, or when system-level components fail to register during stage-2 of the installation boot cycle.
Instead of running generic troubleshooting wizards that fail to resolve deep issues, we can use a sequence of Command Prompt and PowerShell procedures to reset the update framework entirely.
The Core Strategy
Most Windows Update issues are resolved by executing a three-step cycle:
- Stopping the core updating services.
- Clearing the local cache files and metadata databases.
- Repairing system integrity and re-starting services.
Here is the technical walkthrough to perform this reset safely.
1. Stop Update Services
Open Command Prompt or PowerShell as Administrator. To clear cached updates, we must temporarily disable the services locking those files:
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver
wuauservis the core Windows Update service.cryptSvccontrols cryptographic operations (signature validation).bitshandles background file downloads.msiserveris the Windows Installer engine.
2. Purge SoftwareDistribution and Catroot2 Cache
Once services are halted, we can rename the cache directories. This forces Windows to create fresh, clean catalogs upon the next update attempt:
# Rename the cache containing downloaded update packages
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
# Rename the cryptographic cache containing package signatures
ren C:\Windows\System32\catroot2 catroot2.old
If you get an “Access Denied” error, one of the services did not stop completely. Verify service termination status using Get-Service in PowerShell.
3. Repair Component Store Corruptions
Before re-enabling the services, check if corrupted operating system files are preventing update installations:
# Check the health of the local Component Store
dism /online /cleanup-image /restorehealth
# Verify core system file signatures
sfc /scannow
dism compares your local system components against standard Windows indices and downloads replacements for damaged files, while sfc scans and restores system files.
4. Re-enable Services and Fetch Updates
Now, restart the services we stopped in step 1:
net start wuauserv
net start cryptSvc
net start bits
net start msiserver
Open Windows Update (Settings > Update & Security > Windows Update) and click Check for updates. Windows will re-download the updates into clean cache files, bypassing the loop.
Clean Up Old Files
Once the updates compile and install successfully, you can delete the .old directories to reclaim space:
rmdir /s /q C:\Windows\SoftwareDistribution.old
rmdir /s /q C:\Windows\System32\catroot2.old