SOLVED: Easily Script Windows 10 to Download, Install and Restart For Windows Updates

script-windows-updateMicrosoft certainly has been making patching Windows 10 PC’s difficult these days but after some significant effort, I have found a simple combination of commands and one free tool does the trick.

The command in question is an undocumented program inside Windows 10 named C:\Windows\System32\USOClient.exe  This program manages Windows Updates much like the old wuauclt used to:

  1. Launch a CMD prompt or PowerShell AS AN ADMINISTRATOR
  2. Type USOClient.exe ScanInstallWait 
    1. You would expect that command to download and install the updates but it does not appear to, so you have use the next command
  3. Then USOClient.exe StartInstall
    1. The installs will likely take a few minutes to complete so if you are scripting this you are going to want to put a delay timer in (see below)
  4. Then download and unzip the free SHUTDOWNWITHUPDATES directly from the developer, Dennis Babkin, HERE.
  5. Then run SHUTDOWNWITHUPDATES /r /f 
    1. those switches force a reboot and complete the patches installs

Sooooo, below and HERE are the easy script to do this.  Alternately, if you have PDQ Deploy, you can download our PDQ DEPLOY script directly from us HERE.  If do you use this simple PDQ Deploy script you will need to download the SHUTDOWNWITHUPDATES exe and set the path to it in this PDQ Deploy script.

REM Download and Fully Install Windows Updates
REM by Ian Matthews
REM Last Updated Nov 19 2018

REM These two commands do not need a path
usoclient ScanInstallWait
usoclient StartInstall

REM Wait 40 mins to allow all the installs to complete
timeout /T 2400

REM download from
REM this command will need a local path to the file unless it is run from the same folder that contains it
ShutdownWithUpdates.exe /r /f

For more information on USOClient read our USOCLIENT DOCUMENTATION page.

Share This With Your Friends Now:

Leave a Reply