Find Windows Update errors with PowerShell
Windows Update refusing to cooperate? Before resetting anything, it helps to see what Windows is actually reporting. These commands collect a readable log, highlight useful clues and show recent update events so you have somewhere sensible to start.
Before you start
Open Windows PowerShell using Run as administrator, on the affected Windows computer. If possible, reproduce the update failure first and note the time. That makes it much easier to match the error to the right log entries.
The commands read diagnostics and write a log file. They don't restart services, clear update caches or change your network settings. Generating the log again can replace an existing WindowsUpdate.log at the chosen location, so save a copy first if you need to keep it.
1. Create a readable Windows Update log
Get-WindowsUpdateLog -LogPath "$env:USERPROFILE\Desktop\WindowsUpdate.log"
This combines Windows Update's diagnostic traces into a readable file on your Desktop. Give it a moment to finish before running the search below. The generated file is a snapshot: rerun the command after another update attempt to capture newer activity. Microsoft explains the conversion in its Get-WindowsUpdateLog reference.
Using OneDrive for your Desktop? The commands above and below assume your Desktop is inside your user profile. If it has been redirected, use the downloadable script further down: it resolves your Windows Desktop location automatically.
2. Look for error and connection clues
Select-String -Path "$env:USERPROFILE\Desktop\WindowsUpdate.log" -Pattern 'error|failed|0x80072|proxy|connection' -Context 2,3
This displays matching lines with two lines before and three after each match. The surrounding text often tells you more than the error code on its own.
Start with entries around the time of the failed update. Words such as proxy or connection are search clues, not proof that your network is at fault. Likewise, a matching error may belong to an older attempt that later succeeded. Keep the timestamp, full error code and nearby message together when investigating.
3. Check recent Windows Update events
Get-WinEvent -LogName 'Microsoft-Windows-WindowsUpdateClient/Operational' -MaxEvents 100 |
Format-List TimeCreated, Id, LevelDisplayName, Message
This shows the latest 100 events in that channel, newest first. Compare their timestamps and messages with the log search results. If the channel is unavailable or has no events, that alone doesn't mean Windows Update is working correctly. See Microsoft's Get-WinEvent reference.
Prefer one reusable script?
Copy or download the script below to run the same checks together. It uses your actual Desktop folder, including a redirected OneDrive Desktop, and still attempts the event check if log generation fails.
Read through the script before running it on your PC.
# Run in Windows PowerShell as Administrator.
# Collects diagnostic output; does not reset Windows Update or change settings.
$desktopPath = [Environment]::GetFolderPath('Desktop')
if (-not $desktopPath -or -not (Test-Path -LiteralPath $desktopPath -PathType Container)) {
throw 'Your Desktop folder could not be found. Run this from an interactive Windows session.'
}
$logPath = Join-Path $desktopPath 'WindowsUpdate.log'
try {
Get-WindowsUpdateLog -LogPath $logPath -ErrorAction Stop
Write-Host "`nLooking for error and connection clues in $logPath"
Select-String -LiteralPath $logPath -Pattern 'error|failed|0x80072|proxy|connection' -Context 2,3
}
catch {
Write-Warning "Could not generate or search the Windows Update log: $($_.Exception.Message)"
}
Write-Host "`nRecent Windows Update events:"
try {
Get-WinEvent -LogName 'Microsoft-Windows-WindowsUpdateClient/Operational' -MaxEvents 100 -ErrorAction Stop |
Format-List TimeCreated, Id, LevelDisplayName, Message
}
catch {
Write-Warning "Could not read Windows Update events: $($_.Exception.Message)"
}
Save the file, open Windows PowerShell as administrator, change to its download folder and run:
.\get-windows-update-diagnostics.ps1
If your organisation restricts script execution, follow its approved process. You can also use the individual commands above where permitted; there's no need to change execution policy for this guide.
What to share when asking for help
Include the Windows version, the update or KB number, the time of the failure, and the relevant error lines with their surrounding context. Add any matching event IDs and messages. Check for usernames, internal server names and other private details before sharing the output.
If no lines match, broaden your search around the failure time or open WindowsUpdate.log in a text editor. No matches simply means those search terms weren't found; it isn't a clean bill of health.
Once you understand the failure, you can choose the right next step. If an update-component reset is appropriate, our Reset Windows Update guide explains what that script changes before you run it.