> ## Content Index
> Fetch the complete content index at: https://winerror-repair.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# Check for Windows Updates with PowerShell
- URL: https://winerror-repair.org/powershell-check-windows-updates/
- Published: 2026-11-23T03:21:33.000Z
- Updated: 2026-11-23T03:21:33.000Z
- Description: Use the built-in Windows Update Agent to list available updates, interpret empty results and keep update installation separate from the scan.
- Author: Daniel Hayes
- Tags: Windows Update errors and installation problems

In **Windows PowerShell**, create a `Microsoft.Update.Session` object and use its update searcher to find `IsInstalled=0 and IsHidden=0`. That lists matching updates that aren't installed and aren't hidden. Check the search result code before interpreting an empty list; this scan doesn't install updates or restart Windows.

I'd use the built-in Windows Update Agent for a local check before installing another module. Keep the question specific: available updates, installed packages and installation history are different lists. The steps below target a local Windows 11 PC.

## Run the available-update scan

Open Start, search for **Windows PowerShell** and choose **Run as administrator** only with authorization for this PC. Use Windows PowerShell 5.1 for this example. If a work or school device restricts access, have its administrator perform the check; don't change policy or the update server to make a copied command run.

If you opened Windows Terminal, check its selected shell. Terminal hosts the session; its window title alone doesn't establish which PowerShell edition is running. Run `$PSVersionTable` and use the Windows PowerShell session with **PSVersion 5.1** and **PSEdition Desktop**.

Paste this example into the PowerShell session. It creates a [Windows Update Agent searcher](https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatesession-createupdatesearcher?ref=winerror-repair.org), requests an online search and prints update titles only when the search completes successfully:

```
$scan = $null
try {
    $session = New-Object -ComObject Microsoft.Update.Session -ErrorAction Stop
    $searcher = $session.CreateUpdateSearcher()
    $searcher.Online = $true
    $scan = $searcher.Search("IsInstalled=0 and IsHidden=0")

    Write-Host "Search result code:" ([int]$scan.ResultCode)
    Write-Host "Matching updates:" $scan.Updates.Count

    if ([int]$scan.ResultCode -eq 2) {
        for ($i = 0; $i -lt $scan.Updates.Count; $i++) {
            $update = $scan.Updates.Item($i)
            [pscustomobject]@{
                Title = $update.Title
                Downloaded = $update.IsDownloaded
            }
        }
    } else {
        Write-Warning "Search was not fully successful. Do not treat an empty list as up to date."
    }
} catch {
    Write-Error $_
}
```

[Microsoft documents Search as synchronous](https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatesearcher-search?ref=winerror-repair.org), so the session waits for it to finish. Let the current search complete before starting another. A quiet window during the search isn't a completed result, and a thrown error isn't a zero-update finding. Keep the full error text if the command fails.

[New-Object's built-in COM support](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/new-object?view=powershell-5.1&ref=winerror-repair.org) creates the session. It doesn't require PSWindowsUpdate, an execution-policy change or an installation command. It leaves the session's update-server selection unchanged.

The scan doesn't cancel a restart already requested by Windows or stop normal Windows Update activity. Keep any existing restart notice separate from the search result; this example contains no download, install or reboot operation.

## Read the result code before the update list

The search's [ResultCode property describes the search outcome](https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-isearchresult-get%5Fresultcode?ref=winerror-repair.org). Use Microsoft's [operation-result values](https://learn.microsoft.com/en-us/windows/win32/api/wuapi/ne-wuapi-operationresultcode?ref=winerror-repair.org) to interpret it:

| Result                            | What to do with the list                                                        |
| --------------------------------- | ------------------------------------------------------------------------------- |
| 2 Succeeded                       | Read the matching titles and count.                                             |
| 3 Succeeded with errors           | Results may be incomplete. Keep the error evidence before drawing a conclusion. |
| 4 or 5 Failed or aborted          | Investigate the failure or cancellation; don't report zero missing updates.     |
| 0 or 1 Not started or in progress | This isn't a completed successful result.                                       |

The example can print a count even when a search reports errors. Read the result code first; the count alone isn't the success check.

With code **2** and a nonzero count, the titles identify the updates returned by this search. **Downloaded** comes from [IsDownloaded, which means all the update content is cached locally](https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-get%5Fisdownloaded?ref=winerror-repair.org). True doesn't mean the update is installed; the search explicitly asked for uninstalled updates. False doesn't make a returned update inapplicable.

With code **2** and a count of **0**, the search found no matches for these criteria through its configured source. It isn't an audit of every application, driver website, Microsoft product or security requirement. Don't turn that one result into a claim that the whole PC is fully patched.

## Keep available updates separate from history

`IsInstalled=0` selects uninstalled updates, and `IsHidden=0` excludes updates marked hidden. Microsoft's search reference lists this pair as the default search criteria. There is no `Type` restriction in the example, so don't label every returned title a monthly Windows quality update.

If you meant “Which updates are already installed?”, use **Settings > Windows Update > Update history**. The [installed-build and missing-history checks](https://winerror-repair.org/windows-11-update-history-missing/) explain how to corroborate an absent entry and why `Get-HotFix` isn't a complete replacement for every history category.

[![Windows 11 Update history navigation row and its clock icon.](https://storage.ghost.io/c/a6/05/a605dee4-a7e9-4ae9-b795-ec5121bbb083/content/images/2026/11/update-scan-history-ui.webp)](https://storage.ghost.io/c/a6/05/a605dee4-a7e9-4ae9-b795-ec5121bbb083/content/images/2026/11/update-scan-history-ui.webp?ref=winerror-repair.org)

Update history opens past installation records. It answers a different question from the available-update scan.

A [Super User discussion about complete historical records](https://superuser.com/questions/1662946/gather-complete-historical-windows-update-history-in-powershell?ref=winerror-repair.org) shows why this distinction matters: its questioner found proposed command-line history lists incomplete. That isn't evidence that a fresh availability search failed, and changing this example to `IsInstalled=1` wouldn't recreate every past attempt.

If your approved support procedure specifically needs PSWindowsUpdate, follow the [module setup and import verification](https://winerror-repair.org/install-pswindowsupdate/) before using that procedure. A missing module is separate from the native search shown here. Also distinguish Windows updates from [PowerShell 7's own update notifications](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about%5Fupdate%5Fnotifications?view=powershell-7.6&ref=winerror-repair.org); those notifications concern the shell's release.

## If the scan fails or Settings shows something else

Open **Settings > Windows Update** and note the current message, offered package and any error. Microsoft's [Windows Update procedure](https://support.microsoft.com/en-us/windows/deployment/updates-lifecycle/install-windows-updates?ref=winerror-repair.org) uses **Check for updates**, then the offered download/install controls and a restart when prompted. Checking and installing are separate decisions; review the actual screen before approving an installation.

For a work or school PC, give IT the search result code or complete error, Windows version/build and the Settings message. The [searcher's server selection](https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatesearcher-get%5Fserverselection?ref=winerror-repair.org) determines which server it searches. Don't switch to another update source, register Microsoft Update or change organizational settings merely to make the count match another computer.

If the scan throws an access, connection or service error, retain that evidence and use the [failure-stage and update-log checks](https://winerror-repair.org/windows-11-update-failed/). Don't start by deleting update data or making execution policy Unrestricted. Before sharing console text publicly, remove account names, device identifiers and personal paths. If the same package repeatedly fails during installation, record its KB number and installation error; a successful search doesn't establish a successful installation.

After an approved installation and any required restart, check that package's outcome in Update history and run a fresh scan if you still need an availability list. Keep the search result and installation result separately. The [Windows Update hub](https://winerror-repair.org/tag/updates/) connects the package-specific and recovery guides when an actual error remains.