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. 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, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

Leave a Comment