Windows

How to install Windows updates with a reboot

Have you ever wanted to install Windows updates with a reboot, rather than a shutdown? By default Windows will only install updates on Shutdown, and rebooting with pending updates just leaves them waiting.

I needed to schedule a whole number of PCs to install their updates and reboot, without any user being present, so that they were ready and waiting for when the next training session occurred. Luckily I stumbled upon ShutdownWithUpdates by Dennis Babkin. This great utility allows you issue a shutdown or reboot command from the command prompt, or via a script from your RMM tool, and have all the currently pending updates installed in the process.

The following command line will issue a reboot command and install any pending updates. It’s that simple.

shutdownwithupdates /r /f

I’ve included a download link for ease of use and the instructions are below.

[button color=”blue” size=”large” link=”//olivermarshall.net/wp-content/uploads/2016/03/ShutdownWithUpdates.zip” target=”_blank”]Download ShutdownWithUpdates.zip[/button]

 

DESCRIPTION:
================
Utility that initiates installation of pre-downloaded updates on the Windows system & reboots, or shuts it down. Note that if Windows updates were not downloaded prior to calling this utility, the OS will simply perform the power operation.


Usage: ShutdownWithUpdates [/s | /r | /hs | /g | /a | /?] [/f] [/v] [/nu]
        [/m \\computer] [/t x] [/c "msg"] [/d [p|u:]xx:yy]

  /s    Install updates & shut down computer.
         (Updates must be already downloaded on computer being shut down.)
  /r    Install updates & reboot computer.
         (Updates must be already downloaded on computer being rebooted.)
  /hs   Install updates & initiate hybrid shut-down of computer. (Windows 8)
         (Updates must be already downloaded on computer being shut down.)
  /g    Install updates & reboot computer & restart registered applications.
         (Updates must be already downloaded on computer being rebooted.)
  /abo  Go to advanced boot options menu. (Windows 8)
         (Updates will not be installed.)
  /a    Abort previous shut-down/rebooting.
         (Can be used only during previous time-out period.)
  /?    Show command line help.
  /f    Use forced action.
         WARNING: May result in the loss of unsaved data on target computer!
  /v    Show user confirmation before proceeding.
         (Local computer only. It is shown before time-out is initiated.)
  /nu   Not to install updates.
  /m \\computer    Specify target/remote computer.
  /t x  Set time-out before performing action to x seconds.
         (Valid range is 0-315360000, or 10 yrs, with a default of 0.)
  /c "msg"      Message to be displayed in the interactive shutdown dialog box.
                 (Maximum of 512 characters is allowed.)
  /d [p|u:]xx:yy  Reason for shut-down or rebooting (used for logging):
                   p if action was planned.
                   u if action was user-defined.
                   (If neither p or u is used, assumes unplanned.)
                   xx = major reason number (less than 65536.)
                   yy = minor reason number (greater than 65536.)
                        (Reason numbers can be decimal or hex if begin with 0x)
        For major and minor reason values check "System Shutdown Reason Codes":
         msdn.microsoft.com/en-us/library/windows/desktop/aa376885(v=vs.85).aspx


Exit Codes:
 0      if success.
 -1     if general failure in the module.
 Other  if error, will contain "System Error Code". For details check:
         msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx


Examples:
(1) Install updates and reboot local computer without a delay:
    (Fail if unsaved user data on computer.)

      ShutdownWithUpdates /r

(2) Install updates and shut down local computer after 30 sec delay:
    (Force applications with unsaved data to close & lose data! Show message.)

      ShutdownWithUpdates /s /f /t 30 /c "Forced shut-down in 30 sec!"

(3) Do not install updates and reboot remote computer after a 20 sec delay:
    (Fail if unsaved user data on remote computer.)
    (Specify reason as planned, application issue, installation.)

      ShutdownWithUpdates /r /nu /m \\MYSERVER /t 20 /d p:0x00040000:0x00000002

 

What is your reaction?

Strongly Agree
0
Agree
0
Meh
0
Disagree
0
Strongly Disagree
0

You may also like

Leave a reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

More in:Windows