Mastering Windows Updates with PowerShell: A Comprehensive Guide
Learn how to manage Windows Update using PowerShell — check, install, automate, and troubleshoot updates with scripts and commands on Windows 10 and 11.
Windows Update is critical for system security, stability, and performance, especially in enterprise environments or automated workflows. While the Windows Settings app handles updates for most users, PowerShell offers precise control, automation capabilities, and scripting flexibility that make it ideal for administrators, power users, and automation engineers.

In this comprehensive guide, you’ll learn how to manage Windows Updates using PowerShell — from checking and installing updates to scripting policies and troubleshooting. Whether you’re on Windows 10, Windows 11, or managing servers, these techniques will help you master update workflows.
Why Use PowerShell for Windows Updates?
PowerShell brings several advantages over the graphical Windows Update interface:
- Automation — schedule or script update tasks
- Remote management — trigger updates on remote systems
- Detailed reporting — retrieve granular status and history
- Fine‑grained control — install specific updates or packages
- Integration with configuration management systems (e.g., SCCM, Intune)
These capabilities make PowerShell indispensable for managed environments and advanced users who need repeatable and auditable update processes.
Prerequisites: Modules and Permissions
PowerShell interacts with Windows Update through modules and commands that may not be available by default. The most commonly used module is PSWindowsUpdate — a community module that provides robust Windows Update controls.
Installing PSWindowsUpdate
- Open PowerShell as Administrator
- Run:
Install‑Module ‑Name PSWindowsUpdate ‑Force
- If prompted about “NuGet provider” or “untrusted repository”, allow the install.
Note: Administrative privileges are required for many update operations.
Checking for Available Updates
Once PSWindowsUpdate is installed, you can check for available updates:
Get‑WindowsUpdate
This command returns a list of pending updates with details such as KB number, title, and classification (e.g., security, driver, quality). You can capture this output for reporting or filtering.
Filtering by Category
To list only security updates, run:
Get‑WindowsUpdate ‑Category SecurityUpdates
This helps prioritize high‑impact patches.
Installing Windows Updates
Install All Available Updates
To install all detected updates:
Install‑WindowsUpdate ‑AcceptAll ‑AutoReboot
- AcceptAll automatically accepts Microsoft’s license terms
- AutoReboot reboots the system if required
Install Specific Updates
If you want to install only selected updates (e.g., a specific KB):
Install‑WindowsUpdate ‑KBArticleID KB5006674 ‑AcceptAll ‑AutoReboot
This method is useful for targeted deployment or testing on a subset of machines.
Managing Update Reboots
By default, many updates require a reboot to complete installation. PowerShell lets you control reboot behavior:
Suppress Reboot
Install‑WindowsUpdate ‑AcceptAll ‑IgnoreReboot
You can then script a deferred reboot at a controlled time:
Restart‑Computer ‑Force
This is especially useful during maintenance windows.
Schedule a Reboot
To schedule a restart at a specific time:
shutdown /r /t 3600
This schedules a reboot after 3600 seconds (1 hour), giving users time to save work.
Checking Installed Update History
To retrieve the Windows update history with details:
Get‑WindowsUpdateLog
This creates a consolidated update log at the standard location (e.g., Desktop). Alternatively, for a brief summary:
Get‐HotFix
This cmdlet lists installed updates along with installation dates and description.
Running Updates on Remote Systems
PowerShell makes remote update management straightforward using PowerShell Remoting:
Invoke‑Command ‑ComputerName Server01 ‑ScriptBlock { Install‑WindowsUpdate ‑AcceptAll ‑AutoReboot }
Replace Server01 with the remote computer name. You can target multiple systems:
Invoke‑Command ‑ComputerName Server01,Server02 ‑ScriptBlock { Install‑WindowsUpdate ‑AcceptAll ‑AutoReboot }
Use domain credentials or delegated rights as required.
Automating Updates with Scheduled Tasks
To automate Windows Updates using PowerShell:
- Create a script (e.g., UpdateScript.ps1) containing update commands
- Open Task Scheduler
- Create a new task and configure:
- Trigger — Daily, Weekly, or On Startup
- Action — Run PowerShell with your script
- Run with highest privileges
Example Action command:
powershell.exe ‑ExecutionPolicy Bypass ‑File C:\Scripts\UpdateScript.ps1
This automates update tasks and reduces manual intervention.
Advanced Filtering: Installing Only Security Updates
Security‑centric environments may prefer only critical patches:
Get‑WindowsUpdate ‑Category SecurityUpdates | Install‑WindowsUpdate ‑AcceptAll ‑AutoReboot
This ensures only security‑classified updates are installed, reducing potential feature or driver changes.
Handling Failed Updates via PowerShell
If Windows Update fails repeatedly, PowerShell can help reset components:
Reset Update Components
Reset‑WindowsUpdate.ps1
The reset script (which you should obtain from trusted sources such as Microsoft Docs) clears update caches and resets services.
Cleanup Pending Reboots
If a pending reboot blocks future updates:
Get‑PendingReboot
You can script the cleanup or force a reboot with:
Restart‑Computer ‑Force
Logging and Reporting
For enterprise auditing, export update results to a CSV:
Get‑WindowsUpdate | Export‑CSV C:\Logs\WindowsUpdates_$(Get‑Date ‑Format yyyyMMdd).csv ‑NoTypeInformation
This creates a timestamped report useful for compliance and tracking.
PowerShell vs GUI: When to Use Which
| Task | PowerShell | GUI |
|---|---|---|
| Quick end‑user check | ❌ | ✔️ |
| Automation | ✔️ | ❌ |
| Remote updates | ✔️ | ❌ |
| Bulk patch reporting | ✔️ | ❌ |
| One‑off manual install | ✔️/❌ | ✔️ |
PowerShell excels where scalability, repeatability, and scripting control are needed.
Security and Permissions Considerations
- Run as Administrator: Most update commands require elevated rights.
- Execution Policy: Ensure
ExecutionPolicypermits running scripts (BypassorRemoteSigned). - Network Security: When using remoting, secure connections with HTTPS and strong credentials.
Troubleshooting Common Issues
PSWindowsUpdate Not Recognized
Ensure the module is installed:
Get‑Module ‑ListAvailable ‑Name PSWindowsUpdate
Reinstall if needed:
Install‑Module ‑Name PSWindowsUpdate ‑Force
Update Commands Fail
Check services:
Get‑Service ‑Name wuauserv, bits, cryptSvc
Ensure they’re running.
FAQs
Q: Can PowerShell update Windows without internet?
No — Windows Update needs network access unless updates are provided via local WSUS or offline packages.
Q: Does PowerShell replace Windows Update settings?
PowerShell augments control but doesn’t replace system settings unless scripted to alter them.
Q: Can I schedule updates overnight?
Yes — using Scheduled Tasks and PowerShell scripts.
Conclusion
PowerShell turns Windows Update from a manual click‑and‑wait process into a powerful automation platform. Whether you’re a system administrator managing hundreds of machines or an advanced user who wants granular control, PowerShell provides:
- Automation and scheduling
- Remote command execution
- Detailed reporting
- Targeted update installations
Mastering these techniques ensures your systems stay secure, efficient, and up to date with minimal effort.
