Specify active hours range for auto-restarts
Spécifier une plage d’heures d’activité pour les redémarrages automatiques
Explanation
Enable this policy to specify the maximum number of hours from the start time that users can set their active hours.
The max active hours range can be set between 8 and 18 hours.
If you disable or do not configure this policy, the default max active hours range will be used.
Activez cette stratégie pour spécifier le nombre maximum d’heures pendant lesquelles les utilisateurs peuvent définir leurs heures d’activité à partir de l’heure de début.
La plage d’heures d’activité maximum peut aller de 8 à 18 heures.
Si vous désactivez cette stratégie ou si vous ne la configurez pas, la plage d’heures d’activité maximum par défaut sera utilisée.
Use cases
Caps how long a span users may declare as active hours, counted from the start time: 12 hours on Windows 10 1607 and Server 2016, 18 hours on later versions. It prevents users from declaring round-the-clock activity to avoid restarts.
For pre-1903 devices, Microsoft's recommended-values guidance suggests a maximum range of 10.
Microsoft sources: Manage device restarts after updates · Update policies
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate- Value name
SetActiveHoursMaxRange
| 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/ActiveHoursMaxRange
$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 'SetActiveHoursMaxRange' -Value 1 -Type DWord
# Max range
# Possible options:
# 8 = 8
# 9 = 9
# 10 = 10
# 11 = 11
# 12 = 12
# 13 = 13
# 14 = 14
# 15 = 15
# 16 = 16
# 17 = 17
# 18 = 18
Set-ItemProperty -Path $k -Name 'ActiveHoursMaxRange' -Value 18 -Type DWordDisable
# Disable: WindowsUpdate/ActiveHoursMaxRange
$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 'SetActiveHoursMaxRange' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": WindowsUpdate/ActiveHoursMaxRange
$k = 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate'
Remove-ItemProperty -Path $k -Name 'SetActiveHoursMaxRange' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'ActiveHoursMaxRange' -ErrorAction SilentlyContinueOptions (1)
| Label | Control | Registry value | REG type | Constraints / details | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Max range:Portée max. :ActiveHoursMaxRange | Drop-down listenum | ActiveHoursMaxRange | REG_DWORD | Required · Default choice (UI): #10
|