Using the command line to manage Windows Updates gives you precise control over update behavior—ideal for troubleshooting, automation, or systems without GUI access. It lets you check for updates, download them, and install them directly via PowerShell or Command Prompt, bypassing the standard Settings app. You’ll need administrator rights and a stable internet connection; otherwise, commands may fail or leave your system partially updated.
What You'll Need
- An administrator account on the Windows device
- PowerShell (built-in on Windows 10/11) or Command Prompt (cmd.exe)
- Stable internet connection (updates download in full; dial-up or metered connections may block large downloads)
- Windows 10 version 1809 or later (for reliable PowerShell modules); Windows 11 works identically
Step-by-Step
- Open PowerShell as Administrator: Press Win + X, then select Windows PowerShell (Admin) (or Terminal (Admin) if using the newer Windows Terminal app). Confirm the User Account Control prompt if it appears.
- Install the PSWindowsUpdate module (first-time setup only): Run
Install-Module -Name PSWindowsUpdate -Force. When prompted to confirm installation from the PowerShell Gallery, typeYand press Enter. This module provides robust, scriptable control over Windows Update. - Import the module (if not auto-loaded): Run
Import-Module PSWindowsUpdate. This ensures commands likeGet-WUInstallare recognized. - Check for available updates: Run
Get-WUList. This lists all pending updates—including driver, quality, and feature updates—with their titles, KB numbers, and severities. If no updates are pending, the output will be empty or showNo updates found. - Download updates silently: Run
Get-WUInstall -Download -AcceptAll -AutoReboot:$false. The-Downloadflag fetches updates without installing;-AcceptAllskips confirmation prompts;-AutoReboot:$falseprevents automatic restart (you’ll be notified instead). Wait for downloads to complete—this may take minutes depending on update size and speed. - Install downloaded updates: Run
Get-WUInstall -Install -AcceptAll -AutoReboot:$false. The system applies each update sequentially. You’ll see progress likeKB5012345: Installing, followed byKB5012345: Installed. Avoid using the PC during installation. - Verify installation success: After installation, run
Get-WUListagain. All previously listed updates should no longer appear. For extra verification, open Command Prompt (as admin) and runwmic qfe listto list all installed hotfixes; check for the KB numbers from step 4.
Common Mistakes
- Running commands without admin rights: Non-admin accounts cannot download or install updates, resulting in access denied errors. Always launch PowerShell or cmd as Administrator.
- Skipping the module import: If you run
Get-WUInstallwithoutImport-Modulefirst, PowerShell may report the term is unrecognized. Run the import command explicitly, even if the module installed successfully. - Using outdated commands: Older guides reference
wuauclt /detectnoworUsoClient.exe StartScan. These are unreliable on modern Windows versions and often do nothing—avoid them in favor of PSWindowsUpdate. - Ignoring restart requirements: Updates may require a reboot to finalize. Forcing installation with
-AutoReboot:$truecan cause data loss if unsaved work exists. Always set-AutoReboot:$falseunless scripting unattended deployments.
Tips
- Use filters to target specific updates: Run
Get-WUInstall -KBArticleID "KB5012345" -Installto install only one update—useful for critical patches. - Suppress updates temporarily: Run
Set-Service -Name wuauserv -StartupType Disabledto pause Windows Update services (re-enable withSet-Service -Name wuauserv -StartupType Automatic). Not recommended for long-term use. - Log output for auditing: Append
| Out-File C:\Temp\update_log.txtto any command (e.g.,Get-WUList | Out-File C:\Temp\update_log.txt) to save results for later review. - Check update history via Event Viewer: Open Event Viewer > Windows Logs > System, filter for Event ID 19 (successful install) or 20 (failure). This complements command-line verification.
- For headless servers: Combine with Task Scheduler to automate monthly checks. Example: Set a task to run
Get-WUInstall -Install -AcceptAll -AutoReboot:$trueat 2 a.m. on the first Sunday of each month.
Troubleshooting
- Error: "The term 'Get-WUInstall' is not recognized": The PSWindowsUpdate module isn’t imported. Run
Import-Module PSWindowsUpdateagain, or reinstall withUninstall-Module PSWindowsUpdate -AllVersions; Install-Module PSWindowsUpdate -Force. - Updates fail to download (error 0x80072ee2): This usually indicates a network or proxy issue. Check internet connectivity, disable any third-party firewalls temporarily, and ensure Windows Update URLs (e.g.,
windowsupdate.microsoft.com) are allowed through your proxy. - Updates install but don’t apply (system still shows pending): Run
Get-WUInstall -Install -AcceptAll -ForceRebootto force a reboot after installation. Some updates (e.g., kernel drivers) require a restart to commit changes. - Module installation hangs at "Installing PSWindowsUpdate": The PowerShell Gallery may be slow. Try
Install-Module -Name PSWindowsUpdate -Force -AllowClobber, or manually download the .nupkg file from the gallery and extract it toDocuments\WindowsPowerShell\Modules. - Command completes but no updates appear: Verify Windows Update services are running. Open Services (
services.msc), check that Windows Update and Background Intelligent Transfer Service (BITS) are set to Automatic and Running.
Frequently Asked Questions
Can I use Command Prompt instead of PowerShell?
Yes, but with limitations. Basic tasks likewuauclt /UpdateNow or UsoClient.exe StartScan work minimally, but they lack detailed output and control. For reliable, scriptable updates, PowerShell with PSWindowsUpdate is strongly preferred.
Will this bypass the 24-hour delay for feature updates?
No. Windows 10/11 enforces a 24-hour deferment for feature updates on Home editions and some Pro setups. Command-line tools respect these policies—they cannot override the built-in delay.Does this work on Windows 7?
Partially. PSWindowsUpdate supports Windows 7 only if PowerShell 3.0+ is installed and the system is still receiving updates (ended January 2020). For security, prioritize upgrading to a supported OS.Can I schedule updates for off-peak hours?
Yes—use Windows Task Scheduler. Create a new task, set a trigger (e.g., 2 a.m. weekdays), and configure the action to runpowershell.exe with arguments: -WindowStyle Hidden -Command "Get-WUInstall -Install -AcceptAll -AutoReboot:$false". Ensure the task runs with highest privileges (admin rights).
Do I need internet for offline updates?
Yes, unless you pre-download updates manually. PSWindowsUpdate fetches updates directly from Microsoft Update servers. For offline scenarios, use the Microsoft Update Catalog (catalog.update.microsoft.com) to download .msu files, then install viawusa.exe filename.msu /quiet /norestart.
Is there a risk of breaking the system with command-line updates?
Minimal—if you follow standard practices. Always runGet-WUList first to review updates, avoid skipping critical patches, and ensure backups exist. The PSWindowsUpdate module is vetted by Microsoft MVPs and widely used in enterprise scripts.