Check for Windows updates using PowerShell (Command-line)

To check for new updates and configure Windows Update settings, follow the steps below:

  1. Open Windows Settings (Windows key + i).
  2. Choose Update & Security.
  3. Choose Windows Update from the left hand menu.
  4. Press the Check for updates button in the right hand pane.Check for updatesCheck for updates

Run Windows Update from PowerShell (Command-line)

There is a PowerShell module for Windows Update. You can install and run the module to check for new updates. There are three steps for running Windows Update through PowerShell. Run the following commands step by step:

  1. Install-Module PSWindowsUpdateInstall Module PSWindowsUpdateInstall Module PSWindowsUpdateThis will install the Windows Update module in PowerShell.
  2. Get-WindowsUpdateGet WindowsUpdateGet WindowsUpdateThis command will check for updates.
  3. Install-WindowsUpdateInstall WindowsUpdateInstall WindowsUpdateThis command will install the available updates (which were listed in step 2)

Run Windows Update from Command Prompt (Command-line)

Windows Update can also be run through legacy CMD. The only limitation running Windows Update through command prompt is that it won’t show any progress. Only results are shown. Let’s see how to run it:

  • Go to Run –> cmd
  • Run the following command to check for new updates:
    wuauclt /detectnow 
  • Run the following command to install new updates
    wuauclt /updatenow

Since the command prompt does not show any progress, a better approach would be to check and install updates at the same time. Here’s the command for this:

wuauclt /detectnow /updatenow

The above mentioned command will work in all versions of Windows including Windows 7 and Windows Server 2008 R2. But if you are using Windows 10 or Windows Server 2016, you can use UsoClient command which has more options than wuauclt. You can run UsoClient with the following switches:

StartScan – Start checking for updates

StartDownload – Start downloading updates

StartInstall – Start installing downloaded updates

RestartDevice – Restart Windows after updates are installed

ScanInstallWait – Check for updates, download available updates and install themhttps://474f4de9179a1ad8472eba9a6de8c752.safeframe.googlesyndication.com/safeframe/1-0-37/html/container.html

Hopefully, this will be useful in situations where you want to automate certain Windows functions. What other purposes do you want to use command-line options for running Windows Update?

REF: https://www.itechtics.com/run-windows-update-cmd/