How Do I Fix Windows Update?

Several things to try.

Windows Update can get confused or stuck. I'll review ways to fix Windows Update, including what I refer to as the nuclear option.
The Best of Ask Leo!
Working on updates
Working on updates. (Screenshot: askleo.com)
Question: I returned from vacation and found that Windows Update would not download any of 90 available updates (even though it sat for many hours saying “downloading,” nothing was coming). I eventually used the Windows Readiness program and was able to get 15 or so downloaded and installed, but trying the next group again, it is not downloading anything. There is no error message, just no action at all.

While it works well most of the time, problems with Windows Update can be very, very frustrating. There’s often no specific fix for whatever situation you’re faced with other than to “keep trying” or “let it run”…

…neither of which helps in many cases.

Fortunately, Microsoft has added a troubleshooter and also outlined what I’ll call the nuclear option: resetting Windows Update completely. Regardless of the problem, if it involves Windows Update, I suggest you give this a try.

TL;DR:

Fixing Windows Update

If Windows Update is having problems, the best place to start is with Windows’ built-in troubleshooter. If that doesn’t resolve the issue, there’s a series of command-line tools you can run manually. The latter option re-initializes Windows Update’s view of what needs updating in cases where it has lost track.

Start with the troubleshooter

Click on the Start menu and type “troubleshoot” to search for the available troubleshooters. Click on Troubleshoot settings or Troubleshooting when it appears. In the resulting window, look for “Windows Update” in the right-hand pane (you may need to scroll down to find it), or click on Other troubleshooters and look for Windows Update.

Windows Update Troubleshooter
Starting the Windows Update Troubleshooter. (Screenshot: askleo.com)

Click on Run or Run the troubleshooter to have Windows attempt to diagnose and fix any problems it detects.

Windows Update Troubleshooter in progress.
Windows Update Troubleshooter in progress. (Screenshot: askleo.com)

If it resolves your issue, wonderful. But with software being as complex as it is, I don’t expect the troubleshooter to work in 100% of all cases. If it doesn’t resolve your issue, it’s time to reset Windows Update.

A few notes before we proceed

#1: Following the instructions below incorrectly — heck, perhaps even following them correctly — could damage your Windows installation. I strongly recommend you take a complete image backup prior to performing these steps and be prepared to restore that image backup should something go wrong. Something shouldn’t go wrong, but an image backup will protect you should I be wrong about something not going wrong.

#2: By following the instructions below or downloading and using the scripts provided by either Microsoft or myself, you are assuming complete responsibility for the results. For all I know, there’s something special about your machine I cannot predict or account for. While it’s certainly not the intent, the instructions and/or scripts could render your computer unbootable. Once again, your best defense is note #1.

#3: Don’t just click and run any of the scripts mentioned below. Instead, download the file by right-clicking and saving it to a location on your computer. You’ll run those scripts from within an administrative Command Prompt. Since these are text files, you can examine their contents at will. Note that since they are considered executable files, your security software may need to be told to “allow” the download.

#4: How to interpret the commands below: Since text can be wrapped to accommodate your screen’s display width, observe carefully. If a command is listed with no space between its lines:

Command
more stuff

it’s meant to be typed on a single line with a space between the text. In the example above, you would type:

Command more stuff

followed by the Enter key. If the commands have a blank line between them:

Command 1

Command 2

they’re two distinct commands. Each should be entered on its own and each followed by Enter.

Next: Microsoft’s “If all else fails”

Microsoft has a Knowledge Base article, Windows Update – additional resources, that includes the following quote after it instructs you to run the troubleshooter:

If all else fails, try resetting the Windows Update Agent by running these commands from an elevated command prompt:

net stop wuauserv
rd /s /q %systemroot%\SoftwareDistribution
net start wuauserv

(Or download and run all-else-fails.cmd)

This simply stops the Windows Update service if it’s running, deletes its cache of information, and restarts it.

Microsoft's When All Else Fails
Microsoft’s when-all-else-fails option. (Screenshot: askleo.com)

Finally: fix Windows Update manually

When even the “when all else fails” approach fails, it’s time to do things manually.

The steps and scripts below support Windows 7 and later. If you’re running Windows XP or Vista, it’s past time to upgrade.

Run Command Prompt as administrator

All the following steps require administrative privileges. It’s not enough that your login account is the administrator account; you need to run the Windows Command Prompt as administrator for those privileges to be in effect.

Click the Start button and search for “CMD”.

Run CMD.EXE as Administrator.
Run CMD.EXE as Administrator. Click for larger image. (Screenshot: askleo.com)

Click on Run as administrator when it’s displayed.

This will open an instance of Command Prompt with the administrative access required for what follows.

Stop Services

First, we’ll stop several Windows services. Type the following into the command prompt, each line followed by Enter:

net stop bits
net stop wuauserv
net stop cryptsvc

(Or download and run stop-services.cmd.)

Don’t worry if some of the services report an error that they’re not running. If you are asked, “Do you want to continue this operation? (Y/N) [N]:” reply “Y” followed by Enter.

Delete Download Manager files

Next, we’ll delete a set of files related to the Download Manager.

Del “%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat”

(Or download and run delete-qmgr-files.cmd.) It’s OK if you get a “Could not find” error.

Reset software distribution and reset services

Microsoft recommends you perform this step only if running through these instructions without this step did not resolve the problem.

Ren %systemroot%\SoftwareDistribution\DataStore DataStore.bak
Ren %systemroot%\SoftwareDistribution\Download Download.bak
Ren %systemroot%\system32\catroot2 catroot2.bak
sc.exe sdset bits D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)
sc.exe sdset wuauserv D:(A;;CCLCSWRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)

What Microsoft doesn’t mention is that the first two commands will fail if they’ve been run before, meaning that if the backup folder “%systemroot%\SoftwareDistribution.bak” already exists, or the backup folder “%systemroot%\system32\catroot2.bak” exists, the rename will fail. If that happens, do not proceed until you have removed the pre-existing “.bak” folders manually. Since “%systemroot%” is typically “C:\Windows”, look for “C:\Windows\SoftwareDistribution.bak” and “C:\Windows\system32\catroot2.bak”, and either rename them or delete them. (You did take that image backup, right? Smile).

More confusion: in some versions of Windows, the Ren commands may fail with “Access Denied”. All we can do is ignore those and carry on.

Here’s a batch file that includes those commands, but also pauses after the rename to give you an opportunity to abort: reset-software-distribution.cmd.

Re-register DLLs

Enter the following commands exactly:

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

— or download and run register-dlls.cmd. (And then remember to CD or Change Directory back to where you’ve downloaded the “.cmd” files.)

It’s possible that some will fail. As unnerving as that may seem, it’s OK. Not every system is configured the same way, and thus not every DLL will be present.

Reset the network

Reset network components with the following commands:

netsh winsock reset

(Or download and run reset-network.cmd.)

Restart services

Now we restart the services we stopped earlier.

net start bits
net start wuauserv
net start cryptsvc

(Or download and run start-services.cmd.)

Finally, reboot

Naturally, much of what we’ve done will require a reboot to take final effect.

What did we just do?

After all that mumbo-jumbo, you’re probably wondering what you just did, be it manually or via a script.

The best analogy I can come up with is clearing your browser cache. Just as your web browser tries to avoid multiple downloads and generally speed up your browsing by keeping many things in a cache on your machine’s hard disk, Windows Update does something similar. Rather than re-analyzing, slowing down your system, and perhaps even downloading information repeatedly, it caches much of what it learns about your system on disk.

And just like the browser, sometimes it can get confused.

We’ve simply cleared out the cache and reset a few things to known states so Windows Update can start with a clean slate.

(To be clear, browser caches and the Windows update cache are completely unrelated to one another; just the concepts are similar.)

Do this

If you’re experiencing problems with Windows Update, start with the troubleshooter. There’s a reasonable chance it will resolve any issues. If that fails… well, you now have a nice long list of commands you can enter into an administrative command prompt.

Just remember to back up first. Smile

Another resource? Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

Podcast audio

Play

2 comments on “How Do I Fix Windows Update?”

  1. Leo,

    Just to let you know, the /s option was not in the downloadable reset-dlls.cmd batch file you had available online. I put it in my version for future use to save all those verifications. It seemed to help me get a Windows Defender update through, however the 2024-01 Security Update for Windows 10 22H2 (KB5034441) is still shutting my windows update down with error (0x80070643). They indicate it could be a .Net issue, but I haven’t resolved it yet. Thanks for ALL the great work! You are amazing. And 73 from KD8WRL. :)

    Reply
  2. Microsoft is so perfect!
    Even after weeks, and numerous folks telling them about the update error for (KB5034441), they are still working on it.
    That trillion dollar valuation is working wonders!

    USA, USA, USA!

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.