6

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!

Pranav Jituri
  • 362
  • 1
  • 4
  • 18
  • Are you able to restart the Windows Update service? – Shiffle McDoobles Oct 04 '17 at 15:03
  • @ShiffleMcDoobles - Yes, I can restart the Windows Update Service. But is that something which I should do when an update requires a reboot to finish installation? – Pranav Jituri Oct 04 '17 at 15:04
  • I've only ever restarted the WU service when I've needed to install multiple updates manually and then rebooted at the end. You could try seeing if this key exists and deleting it: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired` (make sure you backup the registry before you make any changes) – Shiffle McDoobles Oct 04 '17 at 15:16
  • Did you try `wuauclt.exe /resetauthorization /detectnow /updatenow`? – Sergei Krivonos Sep 05 '22 at 17:36

4 Answers4

14

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!!!

TRiG
  • 1,310
  • 1
  • 15
  • 33
Pranav Jituri
  • 362
  • 1
  • 4
  • 18
5

Run the following from an elevated command prompt...

usoclient StartScan
John Q Public
  • 51
  • 1
  • 2
0

It is an external tool, but we are using WuInstall (http://www.wuinstall.com)

The command to check would be

wuinstall /search

The command to install would be

wuinstall /install

With psexec you can also script it remotely to be used on multiple servers

GeraldDC
  • 21
  • 1
0

The accepted answer doesn't work. What worked for me is this (in administrator prompt):

usoclient StartInteractiveScan

This refreshes the updates but it also starts installing them immediately. I haven't found a way around that.

Krzaku
  • 19
  • 3
  • 1
    @PranavJituri Like I wrote in my answer, the accepted answer does not work on current Windows. The command I wrote DOES work, but the side effect is that it also starts updating immediately. And I'm getting downvoted, not the guy whose answer doesn't work... Honestly, what is wrong with this site? – Krzaku Apr 10 '21 at 00:16