---
title: "The Windows Update Client Troubleshooting Guide"
description: "Learn how to clear the Windows Update cache, reset Windows Update and ensure your Windows machine gets back to updating flawlessly."
canonical: "https://adamtheautomator.com/clear-windows-update-cache/"
---

# The Windows Update Client Troubleshooting Guide

> Learn how to clear the Windows Update cache, reset Windows Update and ensure your Windows machine gets back to updating flawlessly.

Source: https://adamtheautomator.com/clear-windows-update-cache/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![The Windows Update Client Troubleshooting Guide](https://adamtheautomator.com/wp-content/uploads/2021/03/The-Windows-Update-Client-Troubleshooting-Guide.jpg)

# The Windows Update Client Troubleshooting Guide

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)17 March 20217 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Windows 10](/tag/windows-10/)[windows server](/tag/windows-server/)

Table of Contents

*   [Prerequisites](#h-prerequisites)
*   [The Windows Update Agent (WUA)](#h-the-windows-update-agent-wua)
*   [How to Fix Windows Update Issues](#h-how-to-fix-windows-update-issues)
*   [Reproduce the Issue and Inspect the Windows Update Log](#h-reproduce-the-issue-and-inspect-the-windows-update-log)
*   [Confirm Critical Services are Started](#h-confirm-critical-services-are-started)
*   [Clearing the Windows Update Cache](#h-clearing-the-windows-update-cache)
*   [Removing the Qmgr DAT Files](#h-removing-the-qmgr-dat-files)
*   [Going Nuclear: Resetting the Windows Update Cache](#h-going-nuclear-resetting-the-windows-update-cache)
*   [Conclusion](#h-conclusion)

Windows updates are a critical component of both Windows client and server operating systems. They keep Windows secure and are supposed to be automatic. But when you find yourself needing to clear a Windows Update cache or deal with a “_Windows Update Client failed to detect with error_“, that automatic nature soon changes.

In this article, you’re going to learn to troubleshoot Windows Updates at the client level. You’ll learn how Windows Updates work (at a high level), how to perform basic troubleshooting using logs and how to fix common Windows Update issues.

## Prerequisites

To ensure all of steps this tutorial covers will apply to you, please be sure you have the following:

*   A Windows 7+ or Windows Server 2012+ machine – The demo environment used in this tutorial was running Windows 10 Build 1909 but Windows 7 (and possibly earlier versions) will work as well.
*   Logged into Windows as an administrative user. You’ll need to run some commands as administrator.

Related:[How to Run PowerShell as Administrator](https://adamtheautomator.com/powershell-run-as-administrator/)

## The Windows Update Agent (WUA)

The primary culprit when it comes to problems with Windows Update is the Windows Update agent. The agent is in charge of coordinating detecting, downloading, and installing updates. The agent is what coordinates the Windows Update service (_wuauserv_) and is a DLL library located in _C:\\Windows\\System32_ called _wuaueng.dll_.

Sometimes, on Windows 8.1/Windows Server 2012 and earlier operating systems, it was necessary to update the agent to a later version. Although updating the agent is far less common and necessary, if you’re running an older operating system, you should [ensure it’s running the latest agent version](https://docs.microsoft.com/en-US/troubleshoot/windows-client/deployment/update-windows-update-agent).

To check for the agent version installed on your computer:

1.  Open up Windows File Explorer.
2.  Navigate to the _C:\\Windows\\System32_ folder.
3.  Find the _wuaueng.dll_ file, right-click on it and go to **Properties**.
4.  In the **Properties** windows, click on the **Details** tab as shown below. The WUA version will be the **File version**.

![Property Windows Details](https://adamtheautomator.com/wp-content/uploads/2021/03/Untitled-2021-03-11T090914.422.png)

Property Windows Details

Typically, with Windows 10 and later versions, the WUA will always be at the latest version already. To be sure though, be sure to check the [Microsoft documentation](https://docs.microsoft.com/en-US/troubleshoot/windows-client/deployment/update-windows-update-agent).

## How to Fix Windows Update Issues

Rather than give you more background on Windows Updates, let’s get down to brass tacks. Let’s cover how you can clear the Windows update cache and potentially fix many of those annoying “_Windows Update Client failed to detect with error”_ error message you’re getting.

## Reproduce the Issue and Inspect the Windows Update Log

To troubleshoot any issue on a computer, you must be able to reproduce it. Chasing down a problem that only randomly pops up can be one of the most annoying tasks ever.

Before changing anything on the computer, you should first invoke a full update process. This update process will detect available updates and, depending on if you have automatic downloads and installation set, will also download and install updates.

To kick off the update process on Windows 10:

1.  Click on the Start Menu and type in _powershell_.
2.  Right-click on **Windows PowerShell** and click **Run as Administrator**.
3.  In your PowerShell console, create a new [AutoUpdate COM object](https://docs.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iautomaticupdates) and invoke the `DetectNow()` method. PowerShell gives you programmatic access to the [AutoUpdate COM object](https://docs.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iautomaticupdates) to invoke the method that kicks off the Windows Update agent.

```powershell
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
```

4\. You can see that the AutoUpdate COM object has other methods on it too that may come in handy down the road.

![AutoUpdate COM object](https://adamtheautomator.com/wp-content/uploads/2021/03/Untitled-2021-03-11T150504.936.png)

AutoUpdate COM object

> _If you’re running Windows 8.1/Server 2012 or older, you may also use the [Windows Update client (C:\\Windows\\System32\\wuauclt.exe)](https://docs.microsoft.com/fr-fr/security-updates/windowsupdateservices/18127351) with the `/detectnow` switch. As of Windows 10 though, PowerShell has replaced this switch._

When you run the above PowerShell command, you should get no output. How do you know it did anything? Check the Windows Update log.

5\. While still in PowerShell run the [`Get-WindowsUpdateLog` command](https://docs.microsoft.com/en-us/powershell/module/windowsupdate/get-windowsupdatelog). This command collects all Windows Update events and creates a _WindowsUpdate.log_ text file in the current directory.

![](https://adamtheautomator.com/wp-content/uploads/2021/03/Untitled-2021-03-11T151037.040.png)

Get-WindowsUpdateLog command

> _Windows 10 uses event tracing for Windows (ETW) to generate diagnostic logs. You can no longer read the C:\\Windows\\System32\\WindowsUpdate.log log file directly._

6\. Inspect the _WindowsUpdate.log_ file and you should see a few lines similar to below. These lines indicate when the WUA initiates. From here, scroll down and notice if you can see any problems.

![WindowsUpdate.log file](https://adamtheautomator.com/wp-content/uploads/2021/03/Untitled-2021-03-11T151218.984.png)

_WindowsUpdate.log_ file

## Confirm Critical Services are Started

Window Updates depends on four Windows services to function correctly:

*   _[Background Intelligent Transfer Service (BITS)](https://docs.microsoft.com/en-us/windows/win32/bits/background-intelligent-transfer-service-portal)_
*   _Windows Update_ service
*   Cryptographic Services
*   Windows Installer

If any of the above services are stopped (_excluding Windows Installer_), updates will fail to work.

To check on important services, use the [Windows Services Manager](https://www.thewindowsclub.com/open-windows-services) option or use PowerShell. Since you probably already have PowerShell open, let’s go that route.

To check on the status of each service use the `Get-Service` PowerShell command as shown below.

```powershell
Get-Service -Name wuauserv,bits,cryptsvc
```

Notice below that both services have a `Status` of `Running`. If you don’t see this, you’ll need to start them.

![Get-Service with Status or Running](https://adamtheautomator.com/wp-content/uploads/2021/03/Untitled-2021-03-11T151335.497.png)

Get-Service with Status or Running

To start the services, hit the Up arrow on your keyboard to bring up the last command and then add the `Start-Service` command to the end like below.

```powershell
Get-Service -Name wuauserv,bits,cryptsvc | Start-Service
```

Related:[How to Manage Windows Services with PowerShell](https://adamtheautomator.com/powershell-start-service/)

## Clearing the Windows Update Cache

If the services are running and you’re still having trouble with Automatic Updates, it’s time to clear the Windows Update cache. When Windows downloads and install updates, it downloads metadata and sometimes caches the binaries for each update.

Depending on what you define as the “cache”, there are different levels of intrusiveness you can apply to this approach. You should start from the least intrusive and test again. If you’re still seeing a problem, proceed to the next troubleshooting step.

### Removing the Qmgr DAT Files

One of the most least intrusive ways of clearing the Windows Update cache is to remove all _qmgr_ files from _%ALLUSERSPROFILE%\\Application Data\\Microsoft\\Network\\Downloader_ folder. But first, you must stop all of the applicable services mentioned above.

```powershell
Get-Service -Name wuauserv,bits,cryptsvc | Stop-Service
```

Once you’ve stopped all of the services, run the following:

```powershell
Remove-Item -Path "$env:ALLUSERSPROFILE\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
```

> _While attempting to remove qmgr files, you may receive an error stating “The process cannot access the file because it is being used by another process”. If so, restart your computer and try again. If the error continues, reboot Windows in [safe mode](https://support.microsoft.com/en-us/windows/start-your-pc-in-safe-mode-in-windows-10-92c27cff-db89-8644-1ce4-b3e5e56fe234) and try again._

PowerShell should should remove all caches updates. Once it’s done, start up the services again and cross your fingers!

```powershell
Get-Service -Name wuauserv,bits,cryptsvc | Start-Service
```

### Going Nuclear: Resetting the Windows Update Cache

If the above step didn’t help, it’s time to go nuclear. It’s time to completely reset the entire Windows Update caching system back to default settings.

The “Window Update cache” is not really one component; it’s a combination of components. In the above sections, you were just manipulating the services and file system. Windows Update also has settings in the registry and registers many different DLL files.

Let’s now step through a PowerShell script you can use to reset the Windows Update cache which will make any necessary registry modifications, remove any cached updates and also handle some common issues with [Windows Server Update Services (WSUS)](https://docs.microsoft.com/en-us/windows-server/administration/windows-server-update-services/get-started/windows-server-update-services-wsus).

To run the below script:

1.  Click on your start menu and type _ise_.
2.  Right-click on **PowerShell ISE** and click **Run as Administrator**.
3.  Click on **View** and then click on **Show Script Pane**. This action should bring up a place where you can write a script in.
4.  Copy the below script into the script pane.

```powershell
Write-Host 'Stopping all necessary services…'
Get-Service -Name wuauserv,bits,cryptsvc,msiserver | Stop-Service

Write-Host 'Removing all qmgr.dat files…'
Remove-Item -Path "$env:ALLUSERSPROFILE\Application Data\Microsoft\Network\Downloader\qmgr*.dat"

Write-Host 'Backing up Windows Update cache folders…'
Rename-Item -Path "$env:SYSTEMROOT\SoftwareDistribution\DataStore" -NewName 'DataStore.bak'
Rename-Item -Path "$env:SYSTEMROOT\SoftwareDistribution\Download" -NewName 'Download.bak'
Rename-Item -Path "$env:SYSTEMROOT\System32\catroot2" -NewName 'catroot2.bak'

Write-Host 'Resetting BITS and Windows Update services security descriptors…'
$null = Start-Process -FilePath 'sc.exe' -ArgumentList 'sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)'
$null = Start-Process -FilePath 'sc.exe' -ArgumentList 'sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)'

Write-Host 'Re-registering all requisite DLLs…'
$dlls = @(
     'atl.dll'
     'urlmon.dll'
     'mshtml.dll'
     'shdocvw.dll'
     'browseui.dll'
     'jscript.dll'
     'vbscript.dll'
     'scrrun.dll'
     'msxml.dll'
     'msxml3.dll'
     'msxml6.dll'
     'actxprxy.dll'
     'softpub.dll'
     'wintrust.dll'
     'dssenh.dll'
     'rsaenh.dll'
     'gpkcsp.dll'
     'sccbase.dll'
     'slbcsp.dll'
     'cryptdlg.dll'
     'oleaut32.dll'
     'ole32.dll'
     'shell32.dll'
     'initpki.dll'
     'wuapi.dll'
     'wuaueng.dll'
     'wuaueng1.dll'
     'wucltui.dll'
     'wups.dll'
     'wups2.dll'
     'wuweb.dll'
     'qmgr.dll'
     'qmgrprxy.dll'
     'wucltux.dll'
     'muweb.dll'
     'wuwebv.dll'
)
foreach ($dll in $dlls) {
    regsvr32.exe "$env:SYSTEMROOT\System32\$dll" /s
}

Write-Host 'Removing WSUS registry values…'
@('AccountDomainSid','PingID','SusClientId','SusClientIDValidation') | ForEach-Object {
     Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" -Name $_ -ErrorAction Ignore
}

## Resets computer group membership
Write-Host 'Resetting WSUS client cookie..,'
$null = wuauclt.exe /resetauthorization

Write-Host 'Starting all necessary services…'
Get-Service -Name wuauserv,bits,cryptsvc | Start-Service

Write-Host 'Initiating update cycle…'
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
Write-Host 'Windows Update reset complete.'
```

5\. Click on **File** —> **Save** and save the script somewhere on your computer. This tutorial will assume it’s in _C:\\FixWindowsUpdates.ps1_.

6\. Click on the green triangle in the PowerShell ISE to run the script.

![Run the Script](https://adamtheautomator.com/wp-content/uploads/2021/03/Untitled-2021-03-11T152211.848-1.png)

Run the Script

> _If you’re more of a fan of a GUI, you can also find [a tool](https://github.com/ManuelGil/Reset-Windows-Update-Tool) that performs similar steps. But, I can’t confirm it covers the exact same steps given in the PowerShell script from above._

## Conclusion

To get necessary updates to download and install automatically in the background on a Windows machine is an orchestration of many tasks. Although, you may run into dozens of different error messages, the tips and scripts you’ve learned in this guide should help you remediate just about all of them.

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fclear-windows-update-cache%2F&text=The%20Windows%20Update%20Client%20Troubleshooting%20Guide)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fclear-windows-update-cache%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fclear-windows-update-cache%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2019/06/photo-1516382799247-87df95d790b7.jpg)

### [Finding PowerShell Last Logon by User Logon Event ID](/user-logon-event-id/)

Learn how to build a user activity PowerShell script that will pull information from the Windows event log for a local computer.

![](https://adamtheautomator.com/wp-content/uploads/2021/02/How-and-Why-to-Use-the-Netsh-Winsock-Reset-Command-In-2021.jpg)

### [Netsh Winsock Reset Command (In 2021) : A Complete Guide](/netsh-winsock-reset/)

Perform a Winsock Reset with the netsh winsock reset command and TCP/IP reset with the netsh int ip reset command to fix common network problems!

![](https://adamtheautomator.com/wp-content/uploads/2021/02/How-to-Create-Checksums-in-Windows-Built-in-and-Third-Party-Tools.jpg)

### [Create Checksum in Windows and Verify File Integrity](/checksum-windows/)

Learn in this in-depth article that covers nearly all the ways to generate checksums in Windows using built-in and third-party tools.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
