Windows Update on Server Stops Working Properly

We had a Server 2016 machine where Windows Update would get stuck at “Downloading 100%.”  Trying to install the updates manually would get stuck at “Copying packages to the update cache.” Here’s how we fixed it:

  1. Write down the KB numbers of the pending updates.
  2. Download the offline installers for the above KB numbers, if you haven’t already, from the Microsoft Update Catalog here: https://www.catalog.update.microsoft.com
  3. Open Services and change Windows Update Startup type to “Disabled.”
  4. Open an elevated command prompt.
  5. net stop wuauserv
    (If it cannot be stopped, find the PID for the service in Task Manager and kill it with
    taskkill /f /pid <PID for process>)
  6. net stop cryptSvc
    net stop bits
    net stop msiserver
    del /f /q “%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat”
    del /f /s /q %SystemRoot%\SoftwareDistribution\*.*  (This may take a long time)
    del /f /s /q %SystemRoot%\system32\catroot2\*.*
    del /f /q %SystemRoot%\WindowsUpdate.log
  7. Go back to Services and change the Startup type for Windows Update to Manual
  8. Now back to the elevated Command window:
    net start cryptSvc
    net start bits
    net start msiserver
  9. Now manually install the updates from step #2 above
  10. Now change the startup for Windows Update to Automatic and start it if it’s stopped.