The Corrupted Update Loop
Windows Update is a highly complex orchestration engine. When a Windows Server or Windows 10/11 machine checks for updates, it compares its current state against Microsoft’s servers, downloads the necessary patches into a temporary folder, and records the installation status in a hidden SQLite database.
This entire process is managed within the C:\Windows\SoftwareDistribution directory. Over time, particularly after a sudden power loss during a patch cycle or a failed cumulative update, the DataStore (the database tracking the updates) or the Download cache (the physical patch files) can become severely corrupted.
The symptoms of a corrupted SoftwareDistribution folder include Windows Update getting permanently stuck at “Checking for updates…”, updates downloading to 99% and throwing a cryptographic error code (like 0x80070002), or the server repeatedly offering the exact same update even after it was successfully installed. To break this cycle, you must forcefully purge the cache and reset the Windows Update engine using PowerShell.
Locating the SoftwareDistribution Directory
The SoftwareDistribution folder contains several subdirectories, but the two critical ones are:
- DataStore: Contains the
DataStore.edbfile, which is the historical database of all scanned and installed updates. - Download: Contains the raw, encrypted
.caband.msuupdate files downloaded from Microsoft or your local WSUS server.
Clearing the Cache using PowerShell
Because the Windows Update service (wuauserv) and the Background Intelligent Transfer Service (BITS) are actively holding locks on these files, you cannot delete them via File Explorer. You must orchestrate a complete shutdown of the update engine, purge the files, and restart the services.
Open PowerShell as Administrator and execute the following script carefully:
# 1. Stop the Windows Update Service
Stop-Service -Name wuauserv -Force
# 2. Stop the Background Intelligent Transfer Service (BITS)
Stop-Service -Name bits -Force
# 3. Stop the Cryptographic Services (Optional, but highly recommended for stubborn corruptions)
Stop-Service -Name cryptsvc -Force
# 4. Delete the physical downloaded update files
Remove-Item -Path "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force -ErrorAction SilentlyContinue
# 5. Delete the update tracking database
Remove-Item -Path "C:\Windows\SoftwareDistribution\DataStore\*" -Recurse -Force -ErrorAction SilentlyContinue
# 6. Restart all necessary services
Start-Service -Name bits
Start-Service -Name wuauserv
Start-Service -Name cryptsvc
The Rebuilding Phase
The moment you execute Start-Service -Name wuauserv, the Windows Update engine wakes up. It looks inside the DataStore folder, realizes the DataStore.edb database is completely missing, and instantly generates a new, 0-byte database file.
Critical Note: Because you just deleted the server’s entire memory of what updates it needs, the very next time you click “Check for Updates,” the scan will take significantly longer than usual (sometimes up to 10 minutes). The server is forced to perform a complete, deep cryptographic scan of the entire operating system, comparing every system file against Microsoft’s master catalog to rebuild its baseline.
Once the scan completes, it will correctly identify the missing patches, download them cleanly into the newly emptied Download folder, and install them without the previous 0x80070002 errors.