guidox / PC

Stop Windows Update from Rebooting in the Middle of Work

TL;DR

Set **ActiveHoursStart/End** wide, turn on **SmartActiveHours**, and set **RestartNotificationsAllowed2=1** so you get a warning instead of a surprise.

Before you start

Requirements

  • Admin rights
  • Windows 11
  • 15 minutes
Step by step

Instructions

01

Read the current restart policy

**Get-ItemProperty** on the WindowsUpdate policy key shows the active hours and the auto-restart settings. A managed device may have them pinned by group policy.

Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' | Select-Object ActiveHoursStart,ActiveHoursEnd,SmartActiveHoursState,IsExpedited
Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -ErrorAction SilentlyContinue | Select-Object NoAutoRebootWithLoggedOnUsers,AUPowerManagement
02

Set active hours that match your day

Windows will not restart during active hours. The window can be up to 18 hours, which covers a normal working day.

Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name ActiveHoursStart -Value 7 -Type DWord
Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name ActiveHoursEnd -Value 23 -Type DWord
Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name SmartActiveHoursState -Value 1 -Type DWord
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' | Select-Object ActiveHoursStart,ActiveHoursEnd,SmartActiveHoursState
03

Ask for a warning before the restart

**RestartNotificationsAllowed2** enables the toast that offers a choice instead of a countdown. Without it, Windows restarts as soon as the grace period ends.

Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name RestartNotificationsAllowed2 -Value 1 -Type DWord
Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' -Name IsContinuousInnovationOptedIn -Value 1 -Type DWord -ErrorAction SilentlyContinue
Start-Process ms-settings:windowsupdate
04

Hold the restart while a session is open

The policy **NoAutoRebootWithLoggedOnUsers** blocks the automatic restart while anyone is logged on. It is a blunt tool, and it is the right one for a workstation that runs long jobs.

New-Item 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Force | Out-Null
Set-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name NoAutoRebootWithLoggedOnUsers -Value 1 -Type DWord
Set-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name AUPowerManagement -Value 0 -Type DWord
Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' | Select-Object NoAutoRebootWithLoggedOnUsers,AUPowerManagement
05

Check what is waiting to install

A pending update with a short deadline forces the restart regardless. Knowing it is there lets you install it on your own terms.

$s = New-Object -ComObject Microsoft.Update.Session
$sr = $s.CreateUpdateSearcher()
$sr.Search('IsInstalled=0 and IsHidden=0').Updates | Select-Object Title,IsDownloaded,Deadline
Get-WinEvent -LogName 'Microsoft-Windows-WindowsUpdateClient/Operational' -MaxEvents 15 -ErrorAction SilentlyContinue | Where-Object Id -in 19,43,44 | Select-Object TimeCreated,Id,Message -First 5
06

Verify with a scan

After a scan, the settings page should show a restart time outside the active hours, or an explicit schedule. If it still shows a countdown, a policy is overriding it.

usoclient StartScan
Start-Sleep -Seconds 30
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings' | Select-Object ActiveHoursStart,ActiveHoursEnd,RestartNotificationsAllowed2
Get-Service wuauserv | Select-Object Status,StartType
Troubleshooting

Common issues

The values revert after a reboot

Group policy or a management agent rewrites them. Check with gpresult /h whether a policy sets the same keys.

Active hours are greyed out in Settings

A policy controls them. Edit the policy path first, then the UI follows it.

It still restarts at night

Outside active hours Windows is allowed to restart. That is by design; the policy key is the only way to block it entirely.

A quality update is stuck waiting

Install it manually from Settings > Windows Update. A pending update with a deadline does not respect active hours.

FAQ

Frequently asked

Does this stop security updates?

No. They still download and install; only the automatic restart is affected. The machine ends up unpatched if you never restart.

Is 18 hours really the maximum?

Yes. Windows enforces a limit so a machine cannot stay in active hours all day.

Should I use the policy on a laptop?

Only if it stays plugged in. A laptop that closes the lid can miss the update window for days.

How to undo this

Delete the AU policy values with Remove-ItemProperty and set ActiveHoursStart and ActiveHoursEnd back to your previous values.

Changelog · 1 entry
  1. 2026-11-01
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress