The Windows Update Command Line in PowerShell quickly checks for and applies patches, restoring security, performance, and compatibility. You won’t need admin rights for basic checks, but installing updates often requires elevated privileges—open PowerShell as administrator first (Windows + X > *Windows Terminal (Admin)* or *Task Manager > Run new task > PowerShell*). For a one-time update, use `winget upgrade --all` (requires Windows 11 or Windows 10 20H2+ with Winget installed). For critical fixes, the traditional `Get-WindowsUpdateLog` and `Install-WindowsUpdate` commands work on all versions.

What You'll Need

  • Admin rights for installing updates and rebooting (unless using `winget`).
  • PowerShell 5.1+ (included in Windows 10/11). For older systems, use the built-in `wbadmin` command.
  • A stable internet connection (cellular may fail for large updates).
  • (Optional) A backup before resetting Windows settings (see Troubleshooting).

Step-by-Step

  1. Open PowerShell as Administrator: Press Win + X, then select *Windows Terminal (Admin)* (or *Task Manager > File > Run new task*) and type `powershell` before choosing *Run as administrator*. If prompted, click *Yes*.
  2. Check for available updates: Run: Get-WindowsUpdateLog to verify your current update state and list pending fixes. Note the UpdateID or KB Article ID for troubleshooting later.
  3. Install updates interactively (UI-guided): Use this command to show a window where you can select updates: Get-HotFix -HotFixID (Get-WindowsUpdateLog).UpdateID | Invoke-HotFix or (Windows 11/20H2+): winget upgrade --all to install all *recommended* updates at once.
  4. Force a silent install (no UI): For manual KB updates (e.g., KB5034560), use: Start-Installation -HotFixID "KB5034560" -Install Replace KB5034560 with the specific update ID from
  5. 2
  6. . Check Get-WindowsUpdateLog first.
  7. Reboot if required: Some updates trigger automatic restarts. If not, run: Get-WindowsUpdateLog -Status | Where-Object { $_.RebootRequired -eq $true } Then reboot manually. Ignore the "Please wait" prompt if stuck.
  8. Verify the update: Restart, then confirm by running: Get-WindowsUpdateLog -Report in PowerShell. Look for Status = Installed under the update's KB ID.

If That Did Not Work

If updates fail silently or appear stuck, try: 1. **Retry with `--force` flag**: Add `-Force` to commands (e.g., `Get-HotFix -HotFixID ... | Invoke-HotFix -Force`). 2. **Clear update cache**: Delete these files in File Explorer: - `%LocalAppData%\Microsoft\Windows\SoftwareDistribution` - `%LocalAppData%\Packages\Microsoft\Windows\CurrentVersion\StoreCache` Then restart. 3. **Check network status**: Use `Test-NetConnection 8.8.8.8` to confirm DNS works. If blocked, use a VPN or proxy. 4. **Install updates via Settings first**: Open *Settings > Windows Update > Advanced options > Optional updates*, install the missing KB updates manually.

Common Mistakes

  • Using PowerShell 5.1 on Windows 11: Windows 11 requires PowerShell 7+ for `winget` and newer cmdlets. Install via *Microsoft Store > PowerShell* or use `Copy-PSModule` from the official repo.
  • Skipping reboots: Critical updates (e.g., security patches) require a restart. Ignoring this may leave vulnerabilities active.
  • Admin rights lost: Close all programs before running PowerShell as admin. Some apps (e.g., anti-virus) may block updates.
  • Typo in KB IDs: Double-check the update ID in `Get-WindowsUpdateLog` before using it in `Invoke-HotFix`.

Tips

  • Automate updates: Schedule a daily check via Task Scheduler: 1. Open Task Scheduler > *Create Task > New*. 2. Set trigger to daily at a quiet time (e.g., 2 AM). 3. Action: *Start a program > `"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"`*. 4. Arguments: `-Command "Get-WindowsUpdateLog -Report | Out-Null"`.
  • Prioritize updates: For Windows 10, use the *Windows Update History* (KB ID) to target only critical fixes instead of forcing all updates.
  • Offline mode: Download updates first via *Settings > Windows Update > Download now*, then install them offline by copying the SoftwareDistribution folder to another PC and restoring it.
  • Check update status: Run `Get-CimInstance Win32_OperatingSystem | Select Version` after updates to confirm the patch level.

Troubleshooting

Problem Solution
Updates fail with "Update installation failed" 1. Open Command Prompt as admin and run: wmic /namespace:\\\\root\cimv2\microsoft\windows\winservice path win32_winservice set startupType=3 (Force restart service). Then retry PowerShell. 2. If still failing, reset the software distribution folder: Remove-Item -Path "$env:LOCALAPPDATA\Microsoft\Windows\SoftwareDistribution" -Recurse -Force (Backup first if needed.)
Windows Update Service (WUS) isn’t running Start it manually: net start wuauserv Or via Services > Windows Update (check *Startup type* is *Automatic*).
Updates stuck at "Downloading" for hours Check bandwidth: Run `netsh interface show interface` to verify the active adapter isn’t throttling. Use a wired connection or disable VPNs/proxies. Try restarting the update service: Restart-Service wuauserv
PowerShell error: "The term 'Get-WindowsUpdateLog' is not recognized" Ensure PowerShell is 5.1+ and loaded as an administrator. If using PowerShell 7+, install the WindowsUpdate module: Install-Module -Name WindowsUpdate

Frequently Asked Questions

Why do I need to install Windows updates from PowerShell?

PowerShell provides granular control over updates, especially for silent installs (e.g., KB patches for servers or specific apps). The built-in Windows Update UI lacks this precision for automated environments.

How do I check if a specific update was installed?

Run Get-WindowsUpdateLog -Report | Where-Object { $_.KBArticleID -eq "KB5034560" } to verify the exact update status. Look for Status = Installed.

What if my PC won’t restart after an update?

Force a reboot via Task Manager (*Ctrl+Shift+Esc > End task > explorer.exe*), then use shutdown /r /f /t 0 in PowerShell to immediately restart.

Can I use PowerShell on a Windows 10 Home PC to install updates?

Yes, but you may need to enable "Windows Update for Business" via Group Policy (edit *gpedit.msc > Administrative Templates > Windows Components > Windows Update > Allow administrative updates*).

Why does my update keep failing with "Access Denied"?

This means PowerShell lacks admin rights. Always run it as administrator, or grant temporary elevated permissions via *UAC*: Run PowerShell, press Ctrl+Shift+Esc to open Task Manager, select *PowerShell.exe*, and click *Run as administrator*.

How do I force an update on Windows 10 2004 (RS2)?

For this version, use: wbadmin /get-updates /odb:D:\Updates | Out-File C:\Temp\Updates.txt Then install manually from the .cab file in the D:\Updates folder. Replace D: with your OS drive.