Windows Update PowerShell commands let you check for, install, hide and review updates from a terminal instead of clicking through Settings. Windows has no fully supported built-in cmdlet that installs updates on Windows 11, so most people use the free community module PSWindowsUpdate for scanning and installing, plus built-in cmdlets such as Get-HotFix and Get-WindowsUpdateLog for checking what's already installed and why something failed.
Can You Run Windows Update from PowerShell?
Yes, but not with a single built-in command on a standard Windows 11 PC. Windows 10 once shipped a small module called WindowsUpdateProvider with cmdlets like Start-WUScan, but it is missing from current client builds, so scripts that rely on it tend to fail with "command not found".
That leaves three practical options:
- Built-in cmdlets for reading information: installed updates, update logs and pending restarts.
- PSWindowsUpdate, a community module published on the PowerShell Gallery by an independent developer (not by Microsoft), for scanning, installing, hiding and removing updates.
- Winget for apps rather than Windows itself. Our guide to updating every app with winget upgrade --all covers that side.
Whichever route you choose, Windows still downloads updates through the same Windows Update service. PowerShell is simply a different front end to it, which is why a broken update service breaks both Settings and your scripts.
Windows Update PowerShell Commands at a Glance
| Task | Command | Source |
|---|---|---|
| List installed updates (KB numbers) | Get-HotFix |
Built in |
| Check one specific update | Get-HotFix -Id KB5xxxxxx |
Built in |
| Build a readable update log | Get-WindowsUpdateLog |
Built in |
| Scan for available updates | Get-WindowsUpdate |
PSWindowsUpdate |
| Install all available updates | Install-WindowsUpdate -AcceptAll |
PSWindowsUpdate |
| Install one update by KB | Get-WindowsUpdate -KBArticleID KB5xxxxxx -Install |
PSWindowsUpdate |
| Hide an update you don't want | Hide-WindowsUpdate -KBArticleID KB5xxxxxx |
PSWindowsUpdate |
| View update history | Get-WUHistory |
PSWindowsUpdate |
| Check if a restart is pending | Get-WURebootStatus |
PSWindowsUpdate |
Replace KB5xxxxxx with the real Knowledge Base number shown in Settings → Windows Update → Update history. Every Windows release gets its own monthly KB numbers, so copy them from your PC rather than from an old forum post.
How Do You Check Installed Updates with Built-in Cmdlets?
Use Get-HotFix to list installed updates and Get-WindowsUpdateLog to turn Windows Update's trace files into a readable log. Both are included with Windows, so there's nothing to install.
- Right-click Start and choose Terminal (Admin). Approve the User Account Control prompt.
- Type
Get-HotFix | Sort-Object InstalledOn -Descendingto see the newest updates first. - To confirm a specific patch, type
Get-HotFix -Id KB5xxxxxx. No result means it isn't installed (or isn't the type this cmdlet reports). - For troubleshooting, run
Get-WindowsUpdateLog. It writesWindowsUpdate.logto your desktop.
One limit to know: Microsoft's Get-HotFix documentation explains that it reads the Win32_QuickFixEngineering class, which only returns updates installed through Component Based Servicing. Updates delivered by Windows Installer, and some other packages, won't appear, so treat Get-HotFix as a quick check rather than a complete history.
How Do You Install Windows Updates with PowerShell?
Install the PSWindowsUpdate module once, then use Install-WindowsUpdate or Get-WindowsUpdate -Install to download and install what Windows Update offers. Run every step in an elevated (administrator) terminal.
- Open Terminal (Admin) from the Start right-click menu.
- Run
Install-Module -Name PSWindowsUpdate. If you're asked to install the NuGet provider or trust the PSGallery repository, read the prompt and answer Y only if you're happy to install from the PowerShell Gallery. - Allow the module to load for this session only with
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process, then runImport-Module PSWindowsUpdate. - Scan with
Get-WindowsUpdateand read the list before installing anything. - Install everything listed with
Install-WindowsUpdate -AcceptAll. Add-IgnoreRebootto restart later or-AutoRebootto restart automatically when needed. - Check whether a restart is still required with
Get-WURebootStatus.
To include updates for other Microsoft products (such as Office installed from an MSI package), add -MicrosoftUpdate to the scan or install command. To skip driver updates, add -NotCategory "Drivers".
The -Scope Process switch matters. It changes the execution policy for the current window only, so you're not permanently loosening script security on the PC just to run one module.
How Do You Hide, Remove or Review an Update?
PSWindowsUpdate can hide an update so it isn't offered again, remove an installed update by KB number, and show the full install history. These are the same jobs you'd otherwise do across several Settings pages.
-
Hide:
Hide-WindowsUpdate -KBArticleID KB5xxxxxx. Reverse it later withShow-WindowsUpdate -KBArticleID KB5xxxxxx. -
Remove:
Remove-WindowsUpdate -KBArticleID KB5xxxxxx -NoRestart, then restart when convenient. -
History:
Get-WUHistorylists past installs with dates and results, including failures.
Hiding a security update leaves a known hole open, so only hide one while you're waiting for a fixed release. If you'd rather use the graphical route, our guide on how to uninstall a Windows update walks through Settings and recovery options.
What If Updates Fail Even from PowerShell?
If PowerShell reports the same failure as Settings, the problem is the Windows Update service or the system image, not the method you used. Repeating the install command won't help until the underlying fault is fixed.
Work through it in this order:
- Run
Get-WindowsUpdateLogand search the log for the KB number to find the error code. - Reset the update cache and services, as described in our guide to repairing Windows Update components.
- Repair the Windows image with DISM RestoreHealth, then run
sfc /scannow. - Restart and scan again with
Get-WindowsUpdate.
Feature updates are a separate case. Moving between Windows 11 versions (for example to 25H2 or 26H2) is better handled through Settings or Microsoft's own tools. Our comparison of the Windows 11 Update Assistant, Installation Assistant and ISO explains which to use.
A Common Mistake We See
A frequent problem is copying a long one-line script from a forum that installs modules, changes the execution policy permanently, disables services and forces a restart, all at once. When something goes wrong, there's no way to tell which part caused it, and the PC may be left with Windows Update switched off.
Run commands one at a time, read the output, and keep execution-policy changes scoped to the session. Also check activation before blaming updates: an unactivated or mismatched edition can produce confusing errors in Settings. If you're building or rebuilding a machine, start with a genuine licence from our Windows 11 collection; our support team can help with activation if a key is rejected.
Frequently Asked Questions
Is PSWindowsUpdate made by Microsoft?
No. PSWindowsUpdate is a community module written by an independent developer and published on the PowerShell Gallery. It's widely used by IT administrators and talks to the standard Windows Update service, but Microsoft doesn't support it. Install it only from the PowerShell Gallery and review what each command will do first.
Do I need to run PowerShell as administrator for Windows updates?
Yes. Installing, hiding or removing updates changes system files, so the terminal must be elevated. Right-click Start, choose Terminal (Admin) and approve the prompt. Read-only commands such as Get-HotFix work without elevation, but install commands fail or return access-denied errors in a standard window.
Can PowerShell install a specific KB update?
Yes, with PSWindowsUpdate. Run Get-WindowsUpdate -KBArticleID followed by the KB number and add -Install. The update must currently be offered to your PC by Windows Update; PowerShell can't install a patch that doesn't apply to your Windows version, edition or build.
Is the Windows Update Assistant the same as PowerShell updates?
No. The Windows Update Assistant and Installation Assistant are Microsoft tools for moving to a newer Windows version. PowerShell commands are mainly for monthly quality updates, drivers and update housekeeping. Use the assistants or Settings for version upgrades and PowerShell for routine patching and checks.
Why does Get-HotFix not show every update?
Get-HotFix only reports updates installed through Component Based Servicing, which covers most Windows cumulative updates. Updates delivered by Windows Installer and some app or driver packages don't appear. For a fuller list, check Update history in Settings or run Get-WUHistory from the PSWindowsUpdate module.
Can I schedule Windows updates with PowerShell?
You can run a PSWindowsUpdate script from Task Scheduler at a set time, and the module includes job commands for remote PCs. For most home and small-office PCs, the active hours and pause options in Settings are simpler and less likely to cause unexpected restarts during work.
Conclusion
Windows Update PowerShell commands are most useful for checking what's installed, reading logs and patching several PCs consistently. Use the built-in cmdlets for information, PSWindowsUpdate for installs, and Settings for version upgrades. If you're setting up a new or rebuilt PC, a genuine key from our Windows 11 Pro product page keeps activation and updates straightforward.
Useful Links
| Resource | Link |
|---|---|
| Windows 11 licences | Windows 11 collection |
| Windows 11 Pro product key | Buy Windows 11 Pro |
| Fix a broken update service | Repair Windows Update components |
| Remove a problem update | How to uninstall a Windows update |
| Get-HotFix reference (Microsoft) | Get-HotFix documentation |
| Get-WindowsUpdateLog reference (Microsoft) | Get-WindowsUpdateLog documentation |
اترك تعليقاً