How to Auto Shutdown after Installing Updates in Windows 10

On patch Tuesdays, you’ll see a bunch of updates such as Adobe Flash Player Security Update, Servicing Stack update, and/or the Cumulative Update showing up in the queue when you open Windows Update settings page. For Asian countries, the updates arrive at night or late night.

Installing a Feature Update or Cumulative Update always requires a restart. Once done, you then have to shut down the device manually if you don’t prefer leaving the computer in sleep or hibernation mode overnight. This means your sleep schedule gets delayed as you’ll have to be awake until the Cumulative Update is fully downloaded and installed.

You may be wondering how to automatically shut down your Windows 10 computer after the updates are installed.

How to Auto Shutdown After Installing Updates in Windows 10

Windows 10 does have an option to automatically shut down the system after installing the updates. But, the option is enabled only after the updates are downloaded and initialized for installation. For instance, when you’re downloading a Feature Update (Windows 10 version upgrade) via Windows Update, you’ll need to wait till the entire update downloads (maybe 3-4 GB of data) and gets initialized. Only after that, the options Update and shut down or Update and restart become available in the Power menu.

install updates and shut down windows 10

If you use the Update and shut down option, the mission is partly accomplished. I say “partly” because any update requiring a reboot — such as a Quality/Cumulative Update or a Feature Update — isn’t installed until a reboot’s taken place. Even if you use the Update and shut down option, the update(s) are installed during the shutdown and then configured during the subsequent boot. In other words, part of the setup runs when you start the system the next time.

To install the updates successfully, you may enable the Restart this device as soon as possible when a restart is required to install an update setting in the Windows Update Settings, Advanced options page.

install updates and shut down windows 10

If you enable the Show a notification when your PC requires a restart to finish updating option, you’ll see a message like below well in advance before the restart event. This dialog allows you to restart the system immediately or postpone the restart event by clicking Not now.

install updates and shut down windows 10

The above setting, which many users may dislike and find aggressive, but it’s desirable in case you want to leave the Windows Update download/install process running unattended after you start Windows, while you’re out of the house, but a restart is needed to complete the update.

Alternately, you can use the Active hours setting in Windows Update options to configure the working hours (the typical time range when your computer will be in use). Windows 10 won’t restart the system during active hours.

install updates and shut down windows 10

Automatically Shut down Windows 10 after installing updates (after a reboot)

After configuring the above Windows Update options, Windows 10 will download updates, install them, and restart your computer automatically. After a restart, your system will be at the lock screen (assuming that the Use my sign-in info to automatically finish setting up my device after an update or restart setting is turned off.)

Use my sign in info to automatically finish setting up my device after an update or restart

You can use Task Scheduler to shutdown Windows 10 automatically at this stage (when no users are logged on). Create a scheduled task that will run at startup and when the system is left idle for a specific time after startup.

You can do so by launching shutdown.exe -s -t 0 using a scheduled task, but it’s always advisable to verify if no users are logged on before shutting down the computer. The task should shut down the system automatically only if no users are logged on. This can be done using PowerShell or VBScript.

Here is a VBScript that you can use with Task Scheduler to shut down the computer after a specified idle timeout — only if no users are currently logged on.

'Shut down the computer if no users are currently logged in.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process WHERE Name='explorer.exe'")
If colProcessList.count = 0 Then
    Dim WshShell : set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "c:\windows\system32\shutdown.exe -s -t 120"
End If

Running the script using Task Scheduler

  1. Copy the above code to Notepad and save the file as shutdown.vbs
  2. Move shutdown.vbs to the C:\Windows directory.
  3. Open Task Scheduler, and click Create Task…
  4. Assign a name and description for the task.
  5. Click Change User or Group…, type SYSTEM and click OK.
  6. Enable Run with highest privileges.
  7. Select the Triggers tab, and click New.
  8. In the Begin the task: dropdown, select At startup, and click OK.
  9. Select the Actions tab, and click New.
  10. In the Program/script: text box, type wscript.exe
  11. In the Add arguments box, type C:\Windows\Shutdown.vbs and click OK.
  12. Select the Conditions tab.
  13. Set Start the task only if the computer is idle for: to 5 minutes
  14. Set Wait for idle for: to 5 minutes
  15. Enable the Wake up the computer to run this task setting.
  16. Click OK to complete the task creation process.
    install updates and shut down windows 10

Windows 10 will now automatically shut down your computer if it has been idle and no users are currently logged on. The script launches the Shutdown.exe command-line with 120 seconds timeout option after which the system shuts down. Before the lapse of the 120-second timeout, the user has the option to abort the scheduled shutdown by running the shutdown.exe /a command-line after logging in.

Note: In Step #8 above, you can also use the On idle trigger. However, Windows may fail to trigger the script or program after the idle time because of a background program or service that’s resetting the idle time.

Definition of “idle” state

The Task Scheduler service will check if the computer is in an idle state every 15 minutes. A computer is considered to be in an idle state when a screen saver is running. If a screen saver is not running, then the computer is considered to be in an idle state if there is 0% CPU usage and 0% disk input or output for 90% of the past fifteen minutes and if there is no keyboard or mouse input during this period of time.

In Windows 8 & Windows 10, Task Scheduler performs the same general user absence and resource consumption checks. However, Task Scheduler relies on the operating system power subsystem to detect user presence. By default, the user is considered absent after four minutes of no keyboard or mouse input. The resource consumption verification time is shortened to 10 minute intervals when the user is present. When the user is away, the verification time is shortened to 30-second intervals. Task Scheduler makes additional resource consumption checks for the following events:

  • User presence state changed
  • AC/DC power source changed
  • Battery level changed (only when on batteries)

When any of the events above happens, Task Scheduler tests the computer for idleness since the last verification time. In practice, this means that Task Scheduler may declare the system as idle immediately after user absence is detected, if the other conditions have been met since the last verification time. The CPU and IO thresholds are set to 80%.

See Microsoft article Task Idle Conditions

Once the quality update or feature update is successfully installed, you may disable the Restart this device as soon as possible when a restart is required to install an update Windows Update option.

One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded in 2005.

3 thoughts on “How to Auto Shutdown after Installing Updates in Windows 10”

  1. It was infinitely easier and sensible in Win 7 to shut down after an update. There was a drop down you could select to update and upon completion, shut down the computer. This option is not available in Win 10, why not? These things shouldn’t be so difficult! Add my name to the growing list of thousands who have no use for your Win 10.

  2. Doesn’t work for me for some reason windows 10 2004, stuck on login screen, no shutdown even though I set it as minimum as 1 min for idle… Do I have to set a screen saver so it goes to idle asap? Cause I can hear my HDD run from time to time, maybe that’s why it doesn’t go idle? Please help…

  3. All I want to do is this when installing W10 updates:

    1) Install update only after I have finished with PC for the day.
    2) Automatically download/install update when I say GO (that is – I am leaving the office)
    3) Automatically Shutdown the PC when update install is complete.
    4) If REBOOT required to complete the update, have PC shutdown automatically again when done.

    That’s it and this must be easy but I haven’t a clue how.


Leave a Comment