Disabling automatic restart after Windows 11 update

Written by

in

The problem

Last night I left my computer importing a big set of photos into my photo database.

When I woke up this morning, all of my open programs had been closed, which immediately told me that my computer had been restarted after a Windows update.

Now, before I tell you how I prevented this from happening in the future, I need to vent.

The rant

I don’t know who are the idiot POs of modern companies like Apple, Microsoft or Google who make all the decisions about what users wants. They clearly have absolutely no clue what they’re doing.

Users don’t want to be forced to restart a computer to apply updates.

There was a time, some 15 to 20 years, when Linux or Mac OS X were able to install software updates while you were using your computer, and you could keep it running without a reboot for as long as you wanted. Some updates would take effect immediately. Others, like kernel updates, would only be applied after a restart, for obvious reasons, but nobody was pressing you to reboot.

On Windows, you would also be able to choose whether to install updates automatically, install them manually or never install them. If you had automatic updates, Windows would demand a restart, but you could choose when to install and when to restart.

These were the days of Mac OS X Tiger and Windows XP. Glorious days.

Then Apple changed it so that you couldn’t use the computer while it was installing updates. Crappy move.

Then Microsoft changed it so that you would have a deadline to install the updates manually, after which it would happen automatically. And then you couldn’t choose when the restart happened anymore.

The result? Now I don’t know if I lost work. I don’t know if I lost data. I don’t know if my photo database has been corrupted.

Thank you Microsoft! You make crappy software that keeps annoying and alienating users.

The research

Searching the internet for a solution, I’ve come across all sorts of pages.

There are some naive pages that present 4 Ways to Easily Disable Windows Updates or 5 ways to stop Windows Update from rebooting your PC.

Well, guess what: I don’t want 5 ways, I want just one frigging way that works!

When you tell me there are 5 ways, what I hear is that all of them are hacks that don’t work 100% as intended. I want the one way that works.

Fortunately, Microsoft hasn’t yet eliminated the proper way to stop Windows updates from restarting your computer, but they’ve made it more difficult for end users to change.

Some pages like these:

point to a solution that requires editing group policies, something that’s only available on Windows Pro, not on Windows Home.

Then there’s a Microsoft documentation page titled Manage device restarts after updates that tells you all the workarounds, including setting active hours (which is not really a valid option in my opinion) and editing the group policy (which is what a hassle and it’s not available on Windows Home).

From the Microsoft documentation it seems that there is actually a registry key that can be used to disable Windows updates, which might make it possible even in Windows Home.

The solution

So let’s summarize the solution options that might work.

Requiring a prompt before restart

Some sources say that you can disable automatic restarts by simply telling Windows to notify you when a restart is required.

I will believe this when I see it, but it’s worth giving it a try, because it’s a simple change that will likely be available on all Windows editions… Unless you’re using Windows Pro, Enterprise or Education and your system administrator has disabled it via group policy. Thanks Microsoft!

To enable update notifications:

  1. Open the Start Menu or press the Windows key.
  2. Search for Windows Update settings and open it.
  3. Click on Advanced options.
  4. Go to Notify me when a restart is required to finish updating and toggle it to On.

Disabling automatic restarts in the Local Group Policy Editor

This is reported to work for Windows 11 Pro, Enterprise and Education.

  1. Press the keys Windows + R.
  2. Write gpedit.msc and press they OK button or Enter in your keyboard.
  3. Navigate to Computer Configuration > Administrative Templates > Windows Components > Windows Update > Legacy Policies.
  4. Double-click on No auto-restart with logged on users for scheduled automatic updates installations.
  5. Select Enabled and press OK.

There’s an interesting note here:

Note: This policy applies only when Automatic Updates is configured to perform scheduled installations of updates. If the “Configure Automatic Updates” policy is disabled, this policy has no effect.

If we go to Computer Configuration > Administrative Templates > Windows Components > Windows Update > Manage end user experience, we will find a policy named Configure Automatic Updates:

Reading the description, it seems that this policy controls the setting that we used to have as an option on Windows XP.

I haven’t tried this, but you could potentially set this policy to Enabled and select option 2 to replicate the Windows XP behavior of notifying before downloading or installing.

This video:

drew my attention to another group policy that prevents Windows update from waking up your computer. This also sounds like a wise thing to disable:

Under Computer Configuration > Administrative Templates > Windows Components > Windows Update > Legacy Policies, double-click on Enabling Windows Update Power Management to automatically wake up the system to install scheduled updates:

and set it to Disabled:

Disabling automatic restarts in the Windows registry

Editing the registry with the graphical editor

To edit the registry using the graphical user interface:

  1. Press the keys Windows + R.
  2. Write regedit.exe and press they OK button or Enter in your keyboard.
  3. Navigate to HKEY_LOCAL_MACHINE > Software > Policies > Microsoft > Windows > WindowsUpdate > AU.
  4. Double-click NoAutoRebootWithLoggedOnUsers.
  5. Change the value to 1.

Chances are that this value doesn’t exist on your system. At least it doesn’t exist on my system.

You can create the value using the command line.

Editing the registry in the command line

First, open a PowerShell windows as administrator. This is very important: we need administrator permission to be able to edit the Windows registry.

You can do this by opening the Start menu, searching for PowerShell, and clicking Run as Administrator:

or via the Run dialog:

  1. Press the keys Windows + R.
  2. Type powershell.
  3. Press they Ctrl + Shift + Enter to run the command as an administrator.

Now you can test if the path exists with the command:

Test-Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"

If it doesn’t exist, you must first create it with the command:

New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -Name AU -Force

Then you can write the key to disable an automatic reboot when a user is logged on:

Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" `
  -Name NoAutoRebootWithLoggedOnUsers -Type DWord -Value 1

And to make sure that this worked, let’s read the key:

Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name NoAutoRebootWithLoggedOnUsers

Now automatic reboots should be disabled, but who knows if Windows will honor it.

As with everything Microsoft, even if you think it will work, it won’t hurt if you still say some prayers.

Editing the registry with registry files

I’ve come across this video that explains how to achieve the same in a very simple way with minimal IT knowledge required:

The advantage of doing it this way is that you can easily enable and disable this behavior at will, if you’re into that kind of thing. I won’t judge you.

Conclusions

By default, Windows is set up to install updates and reboot your computer automatically.

For people with intensive workloads who leave their computer working overnight, this can be very damaging, because you can lose work, lose data, and lose money.

The best way I’ve found to disable this on Windows 11 is to set the registry key that disables automatic reboots when a user is logged on.

With this registry key enabled, you should be able leave some work running overnight and lock your computer, and your computer shouldn’t restart without your consent.

Very important: you must leave your user logged on, either unlocked or locked, but never log out.

Comments

Leave a Reply

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