Transitioning from a desktop administrator role to a system administrator, I recognize the pivotal significance of maintaining a well-updated Windows system. Regular updates play a crucial role in addressing system glitches and introducing performance-enhancing features. While most users navigate updates through graphical interfaces, understanding the utilization of Command-line Interface (CLI) tools like Command Prompt and Windows PowerShell can grant precise control over the update processes.

How to Run Windows Updates Using the Command Line?

Performing Windows updates via the command line involves 2 methods using Command Prompt and Powershell.

Using Command Prompt:

For Windows 10 and 11, Microsoft deploys UsoClient.exe, the Update Session Orchestrator Client, primarily used to check for updates. However, it no longer supports direct installation. Here’s how to use it via Command Prompt:

  1. Open the Run dialog by pressing Win + R.
  2. Type “cmd” and press Ctrl + Shift + Enter to open the Elevated Command Prompt.
  3. Enter specific commands to perform update-related operations, such as initiating a scan, downloading, or installing updates. The following are some specific commands you can use:
    • Start a Scan for Available Updates: UsoClient StartScan
    • Download Updates (without installation): UsoClient StartDownload
    • Install Downloaded Updates: UsoClient StartInstall
    • Scan, Download, and Install Updates: UsoClient ScanInstallWait
    • Restart Your Computer to Complete Update Installation: UsoClient RestartDevice
    • Resume Update Installation After Reboot: UsoClient ResumeUpdate
    • Refresh Update Settings to Default: UsoClient RefreshSettings

On older Windows versions, the Windows Update Agent WUAUCLT.exe was utilized. Enabling Automatic Updates via Group Policy is necessary for this method.

Using PowerShell:

Windows PowerShell, a robust Windows CLI, extends beyond the capabilities of Command Prompt. You can employ PowerShell to run Windows updates by:

  1. Opening the Run dialog with Win + R.
  2. Typing “PowerShell” and pressing Ctrl + Shift + Enter to open the Elevated PowerShell. If using PowerShell 7, you can open it with “pwsh” instead.
  3. Installing the Windows Update Module, which is essential for running update commands.
  4. Using PowerShell commands to scan for, download, and install updates, including options for automatic reboot. Here are some PowerShell commands you can use:
    • Scan for Available Updates: Get-WindowsUpdate
    • Download and Install Available Updates: Install-WindowsUpdate
    • Download, Install, and Automatically Reboot (if necessary): Get-WindowsUpdate -AcceptAll -Install -AutoReboot
    • Install a Specific Update by KB Article ID: Get-WindowsUpdate -Install -KBArticleID 'KB5017859'

These PowerShell commands offer more intricate control over the update process compared to Command Prompts. Moreover, PowerShell allows task automation and customization to align with specific requirements.