Restart immediately after installing Windows updates, regardless of active hours

Can I tell Windows to restart as soon as the updates are finished, regardless of the current time or whether there are applications running?

Almost.

See the Microsoft Docs: "Manage device restarts after updates":

"You can use Group Policy settings, mobile device management (MDM) or Registry (not recommended) to configure when devices will restart after a Windows 10 update is installed. You can schedule update installation and set policies for restart, configure active hours for when restarts will not occur, or you can do both.".

What do I mean by "almost"?, if it's active hours and an update has been installed the computer might want to wait and warn you before rebooting out from under you. That's the "almost" part, during active hours it needs to wait, offer a warning, then if you don't cancel it will reboot - there's not a 'constantly detect if I'm away during active hours' unless you set a very short scheduling delay (which would catch you if you were using the computer and got called away).

Read on at that link (which is on the Microsoft website, so it should remain up to date and redirect if moved; alternatively there's WayBack):

"Schedule update installation

In Group Policy, within Configure Automatic Updates, you can configure a forced restart after a specified installation time.

To set the time, you need to go to Configure Automatic Updates, select option 4 - Auto download and schedule the install, and then enter a time in the Scheduled install time dropdown. Alternatively, you can specify that installation will occur during the automatic maintenance time (configured using Computer Configuration\Administrative Templates\Windows Components\Maintenance Scheduler).

Always automatically restart at the scheduled time forces a restart after the specified installation time and lets you configure a timer to warn a signed-in user that a restart is going to occur.

While not recommended, the same result can be achieved through Registry. Under HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU, set AuOptions to 4, set the install time with ScheduledInstallTime, enable AlwaysAutoRebootAtScheduledTime and specify the delay in minutes through AlwaysAutoRebootAtScheduledTimeMinutes. Similar to Group Policy, AlwaysAutoRebootAtScheduledTimeMinutes sets the timer to warn a signed-in user that a restart is going to occur.

For a detailed description of these registry keys, see Registry keys used to manage restart.

There is additional information about: "Always automatically restart at the scheduled time", "Engaged restart", "Scheduled auto-restart warnings", etc. simply find a combination of settings that works for you without causing too long a wait while unattended (even during active hours) nor commits you to reboot without the opportunity to abort for a period of time.

Maybe a 10 minute warning and a two hour schedule will work for you, a setting to 'download and immediately reboot while I'm away' wouldn't work for the incessant interruptions, a half hour schedule might work if you are anxious to apply updates over any annoyance from being pestered to allow a reboot.


Here's a quick and dirty solution that I've used many times, it's never failed me, but it's not very sophisticated either (sure is easy though).

I guess at how much longer it's going to take, and give it extra time (e.g. 'this won't take more than an hour, I'll give it two'), then I open a command prompt, and start a countdown for that long (TIMEOUT 7200 because 2 hours = 7200 seconds), have it wait till the command finishes (&&), then have it run the shutdown command to reboot the computer.

TIMEOUT 7200 && shutdown -r

You can also use any of the shutdown command's other parameters to e.g. shut down (-s), reboot (-r), reboot and relaunch open apps if possible (-g).

And I recommend that you also add the /NOBREAK argument to the TIMEOUT command so that if the command prompt window has keyboard focus, and the keyboard gets bumped it won't suddenly, and unexpectedly run the shutdown command.

TIMEOUT 7200 /NOBREAK && shutdown -g