Turn off auto-restart for updates during active hours
Désactiver le redémarrage automatique pour les mises à jour pendant les heures d’activité
Explanation
If you enable this policy, the PC will not automatically restart after updates during active hours. The PC will attempt to restart outside of active hours.
Note that the PC must restart for certain updates to take effect.
If you disable or do not configure this policy and have no other reboot group policies, the user selected active hours will be in effect.
If any of the following two policies are enabled, this policy has no effect:
1. No auto-restart with logged on users for scheduled automatic updates installations.
2. Always automatically restart at scheduled time.
Note that the default max active hours range is 18 hours from the active hours start time unless otherwise configured via the Specify active hours range for auto-restarts policy.
Si vous activez cette stratégie, le PC ne redémarrera pas automatiquement après les mises à jour pendant les heures d’activité. Il tentera de redémarrer en dehors des heures d’activité.
Notez que la prise en compte de certaines mises à jour nécessite le redémarrage du PC.
Si vous désactivez cette stratégie ou ne la configurez pas et que vous n’avez défini aucune autre stratégie de groupe de redémarrage, les heures d’activité sélectionnées par l’utilisateur sont appliquées.
Cette stratégie n’a aucun effet si l’une ou l’autre des stratégies suivantes est activée :
1. Pas de redémarrage automatique avec des utilisateurs connectés pour les installations planifiées de mises à jour automatiques.
2. Toujours redémarrer automatiquement à l’heure planifiée.
Notez que la durée maximale d’activité par défaut est de 18 heures à partir de l’heure de début des heures d’activité sauf configuration différente via la plage Spécifier les heures d’activité pour la stratégie de redémarrages automatiques.
Use cases
Active hours stop Windows from restarting automatically during working hours (8 AM to 5 PM by default on PCs, user-adjustable). In most cases Microsoft recommends not enforcing this setting and letting intelligent or user-defined active hours apply.
Forcing it by GPO mainly makes sense for machines with very predictable usage (control rooms, front desks) where you know the exact usage window.
Microsoft sources: Walkthrough: Use Group Policy to configure Windows Update for Business · Manage device restarts after updates
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate- Value name
SetActiveHours
| State | Value written |
|---|---|
| Enabled | REG_DWORD = 1 |
| Disabled | REG_DWORD = 0 |
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Enable
# Enable: WindowsUpdate/ActiveHours
$k = 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'SetActiveHours' -Value 1 -Type DWord
# Start
# Possible options:
# 12 AM = 0; 1 AM = 1; 2 AM = 2; 3 AM = 3; 4 AM = 4; 5 AM = 5; 6 AM = 6; 7 AM = 7; 8 AM = 8
# 9 AM = 9; 10 AM = 10; 11 AM = 11; 12 PM = 12; 1 PM = 13; 2 PM = 14; 3 PM = 15; 4 PM = 16
# 5 PM = 17; 6 PM = 18; 7 PM = 19; 8 PM = 20; 9 PM = 21; 10 PM = 22; 11 PM = 23
Set-ItemProperty -Path $k -Name 'ActiveHoursStart' -Value 8 -Type DWord
# End
# Possible options:
# 12 AM = 0; 1 AM = 1; 2 AM = 2; 3 AM = 3; 4 AM = 4; 5 AM = 5; 6 AM = 6; 7 AM = 7; 8 AM = 8
# 9 AM = 9; 10 AM = 10; 11 AM = 11; 12 PM = 12; 1 PM = 13; 2 PM = 14; 3 PM = 15; 4 PM = 16
# 5 PM = 17; 6 PM = 18; 7 PM = 19; 8 PM = 20; 9 PM = 21; 10 PM = 22; 11 PM = 23
Set-ItemProperty -Path $k -Name 'ActiveHoursEnd' -Value 17 -Type DWordDisable
# Disable: WindowsUpdate/ActiveHours
$k = 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'SetActiveHours' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": WindowsUpdate/ActiveHours
$k = 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate'
Remove-ItemProperty -Path $k -Name 'SetActiveHours' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'ActiveHoursStart' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'ActiveHoursEnd' -ErrorAction SilentlyContinueOptions (2)
| Label | Control | Registry value | REG type | Constraints / details | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Start:Début :ActiveHoursStartTime | Drop-down listenum | ActiveHoursStart | REG_DWORD | Required · Default choice (UI): #8
| ||||||||||||||||||||||||||||||||||||||||||||||||||
| End:Fin :ActiveHoursEndTime | Drop-down listenum | ActiveHoursEnd | REG_DWORD | Required · Default choice (UI): #17
|