Windows – How to force Windows Server 2016 to check for updates

windows-server-2016

Is there any programmatic way to force Windows to check for updates? I have installed an update using the Windows Update API but the following screen does not update.
enter image description here

The Windows Update API says that Reboot is required –

PS C:\Windows\system32> $rebootRequired = (New-Object -ComObject "Microsoft.Update.SystemInfo").RebootRequired

echo $rebootRequired
True

I have tried the following commands as administrator but none of them refreshed the screen –

wuauclt.exe /updatenow
wuauclt.exe /detectnow

Thanks!

Best Answer

The command line utilities in Windows 10 & Windows Server 2016 onwards have changed for Windows Update.

You have to use usoclient StartScan to start a scan.

There are other options as well:

  • StartScan: Used to start scan
  • StartDownload: Used to start download of patches
  • StartInstall: Used to install downloaded patches
  • RefreshSettings: Refresh settings if any changes were made
  • StartInteractiveScan: May ask for user input and/or open dialogues to show progress or report errors
  • RestartDevice: Restart device to finish installation of updates
  • ScanInstallWait: Combined scan, download, and install
  • ResumeUpdate: Resume update installation on boot

I wrote the more detailed blog post “Command Line Equivalent of wuauclt in Windows 10 / Windows Server 2016” at OMGDebugging!!!

Related Question