Windows Components › Windows Update › Manage end user experience
Configure maintenance windows for automatic updates
Supported on At least Windows 11 Version 24H2
Shown as of 2025 · 3.0, 27 Oct 2025. See it in the latest templates.
What it does
This policy allows you to configure maintenance windows during which Windows Update operations can be performed. Enable this policy to specify repeatable maintenance windows for the device to perform specified update actions: • Update Actions: Select which update actions are allowed during maintenance windows: - Download, install, and restart: Complete update cycle including download, installation, and system restart - Install and restart: Install already downloaded updates and restart the system - Restart only: Only perform a system restart for pending updates • Basic Schedule Configuration: - Start Date: Specify the initial date when maintenance window begins (format: yyyy-mm-dd, example: 2025-10-30) - Start Time: Set the time when maintenance window starts (format: hh:mm, example: 23:30 for 11:30 PM) - Duration: Define how long maintenance window remains open (in hours, example: 2 for a 2-hour window) • Recurring Schedule Options: - None: One-time maintenance window on the specified start date only - Daily: Maintenance window repeats every day or at specified day intervals - Weekly: Maintenance window repeats weekly on selected days of the week - Monthly: Maintenance window repeats monthly on specific dates or weekday occurrences • Daily Schedule Settings (when Daily is selected): - Days Interval: Specify how many days are between each maintenance window (example: 1 for daily, 2 for every other day) • Weekly Schedule Settings (when Weekly is selected): - Weeks Interval: Specify how many weeks are between each maintenance window (example: 1 for weekly, 2 for bi-weekly) - Weekday Selection: Choose which days of the week the maintenance window occurs. * Sunday through Saturday: Check boxes to select specific weekdays for the maintenance window • Monthly Schedule Settings (when Monthly is selected): - Monthly Schedule Type: * Month-based: Maintenance window occurs on a specific day of the month * Week-based: Maintenance window occurs on a specific weekday occurrence within the month - Months Interval: Specify how many months are between each maintenance window (example: 1 for monthly, 3 for quarterly) - Day of Month: When using month-based scheduling, specify which day of the month (1-31) - Occurrence in Month: When using week-based scheduling, select which occurrence (First, Second, Third, Fourth, or Last) - Day of the Week: When using week-based scheduling, select which day of the week (Sunday through Saturday) Examples of Monthly Configurations: - Month-based: "3rd day of every month" = Day of Month: 3, Months Interval: 1 - Week-based: "Second Tuesday of every month" = Occurrence: Second, Day of Week: Tuesday, Months Interval: 1 - Week-based: "Last Friday of every quarter" = Occurrence: Last, Day of Week: Friday, Months Interval: 3 When this policy is enabled, Windows Update will only perform the specified update actions during the configured maintenance windows. Specified update actions outside these windows will be deferred until the next maintenance window begins. If you disable or do not configure this policy, Windows Update will follow its default scheduling behavior.
What it writes
- Hive
- HKEY_LOCAL_MACHINE
- Registry key
Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow- Value name
StartDate- When enabled
- DWORD 1
- When disabled
- DWORD 0
In Intune
No native CSP; import the ADMX (Intune-ready).
From Microsoft's Policy CSP DDF files (DDF v2 Files, February 2026), read 24 Nov 2026.
Options
| Option | Type | Registry value | Allowed values |
|---|---|---|---|
| Update actions only allowed inside the maintenance windowDefault: Download, install, and restart (0) | Drop-down list (enum) | UpdateActions |
|
| Start date (Format: yyyy-mm-dd example: 2025-10-30) | Text (text) | StartDate |
Up to 255 characters |
| Start time (Format: hh:mm example: 23:30 for 11:30 PM) | Text (text) | StartTime |
Up to 255 characters |
| Duration (hours)Default: 2 | Number (decimal) | DurationHours |
0 to 4294967295 |
| Select repeat scheduleDefault: None (0) | Drop-down list (enum) | RepeatSchedule |
|
| Days interval (days)Default: 1 | Number (decimal) | DailyFrequency |
0 to 4294967295 |
| Weeks interval (weeks)Default: 1 | Number (decimal) | WeeklyFrequency |
0 to 4294967295 |
| SundayDefault: Checked | Checkbox (boolean) | Sunday |
On (1) or off (0) |
| MondayDefault: Unchecked | Checkbox (boolean) | Monday |
On (1) or off (0) |
| TuesdayDefault: Unchecked | Checkbox (boolean) | Tuesday |
On (1) or off (0) |
| WednesdayDefault: Unchecked | Checkbox (boolean) | Wednesday |
On (1) or off (0) |
| ThursdayDefault: Unchecked | Checkbox (boolean) | Thursday |
On (1) or off (0) |
| FridayDefault: Unchecked | Checkbox (boolean) | Friday |
On (1) or off (0) |
| SaturdayDefault: Unchecked | Checkbox (boolean) | Saturday |
On (1) or off (0) |
| Monthly Schedule TypeDefault: Month-based (0) | Drop-down list (enum) | MonthlySchedule |
|
| Months Interval (months)Default: 1 | Number (decimal) | MonthsFrequency |
0 to 4294967295 |
| Day of the MonthDefault: 1 | Number (decimal) | DayOfMonth |
0 to 4294967295 |
| Occurrence in MonthDefault: First (1) | Drop-down list (enum) | OccurrenceInMonth |
|
| Day of the WeekDefault: Sunday (0) | Drop-down list (enum) | DayOfTheWeek |
|
Configure and deploy
Choose a state and the option values; the output below is generated from the template for exactly that.
Enabled · Computer · template defaults
Registry file (.reg)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow]
"Friday"=-
"Monday"=-
"Saturday"=-
"Thursday"=-
"Tuesday"=-
"Wednesday"=-
"DailyFrequency"=dword:00000001
"DayOfMonth"=dword:00000001
"DayOfTheWeek"=dword:00000000
"DurationHours"=dword:00000002
"MonthlySchedule"=dword:00000000
"MonthsFrequency"=dword:00000001
"OccurrenceInMonth"=dword:00000001
"RepeatSchedule"=dword:00000000
"StartDate"=""
"StartTime"=""
"Sunday"=dword:00000001
"UpdateActions"=dword:00000000
"WeeklyFrequency"=dword:00000001
PowerShell
$ErrorActionPreference = 'Stop'
function Set-RegistryValue {
param(
[Parameter(Mandatory = $true)][string] $Path,
[Parameter(Mandatory = $true)][string] $Name,
[Parameter(Mandatory = $true)][string] $PropertyType,
[Parameter(Mandatory = $true)][object] $Value
)
if (-not (Test-Path -LiteralPath $Path)) {
New-Item -Path $Path -Force | Out-Null
}
New-ItemProperty -LiteralPath $Path -Name $Name -PropertyType $PropertyType -Value $Value -Force | Out-Null
}
function Remove-RegistryValue {
param(
[Parameter(Mandatory = $true)][string] $Path,
[Parameter(Mandatory = $true)][string] $Name
)
if (Test-Path -LiteralPath $Path) {
Remove-ItemProperty -LiteralPath $Path -Name $Name -Force -ErrorAction SilentlyContinue
}
}
function Clear-RegistryKeyValues {
param(
[Parameter(Mandatory = $true)][string] $Path
)
if (-not (Test-Path -LiteralPath $Path)) {
return
}
foreach ($propertyName in (Get-Item -LiteralPath $Path).Property) {
Remove-ItemProperty -LiteralPath $Path -Name $propertyName -Force -ErrorAction SilentlyContinue
}
}
# Policy: Configure maintenance windows for automatic updates
# Name: MaintenanceWindow
# Scope: Machine
# State: Enabled
# Source: WindowsUpdate.admx
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartDate' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'UpdateActions' -PropertyType 'DWord' -Value 0
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartDate' -PropertyType 'String' -Value ''
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartTime' -PropertyType 'String' -Value ''
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DurationHours' -PropertyType 'DWord' -Value 2
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'RepeatSchedule' -PropertyType 'DWord' -Value 0
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DailyFrequency' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'WeeklyFrequency' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Sunday' -PropertyType 'DWord' -Value 1
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Monday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Tuesday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Wednesday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Thursday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Friday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Saturday'
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'MonthlySchedule' -PropertyType 'DWord' -Value 0
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'MonthsFrequency' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DayOfMonth' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'OccurrenceInMonth' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DayOfTheWeek' -PropertyType 'DWord' -Value 0
- The OMA-URI is an inferred ADMX-backed Policy CSP candidate derived from the source ADMX file name and policy name.
- Some Microsoft policies use built-in Policy CSP pages whose area names don't match the ADMX file name, so verify the candidate against Microsoft Learn before deployment.
- The generated payload is incomplete because one or more ADMX element values were not supplied: MaintenanceWindowStartDateID, MaintenanceWindowStartTimeID
ADMX profile candidate (OMA-URI)
./Device/Vendor/MSFT/Policy/Config/ADMX_WindowsUpdate/MaintenanceWindowIntune remediation scripts
Detection
$ErrorActionPreference = 'Stop'
$reasons = [System.Collections.Generic.List[string]]::new()
function Test-RegistryValueExists {
param(
[Parameter(Mandatory = $true)][string] $Path,
[Parameter(Mandatory = $true)][string] $Name
)
if (-not (Test-Path -LiteralPath $Path)) {
return $false
}
return $null -ne (Get-ItemProperty -LiteralPath $Path -Name $Name -ErrorAction SilentlyContinue)
}
function Test-RegistryValueEquals {
param(
[Parameter(Mandatory = $true)][string] $Path,
[Parameter(Mandatory = $true)][string] $Name,
[Parameter(Mandatory = $true)][string] $Kind,
[Parameter(Mandatory = $true)][object] $Expected
)
if (-not (Test-Path -LiteralPath $Path)) {
return $false
}
$valueObject = Get-ItemProperty -LiteralPath $Path -Name $Name -ErrorAction SilentlyContinue
if ($null -eq $valueObject) {
return $false
}
$actual = $valueObject.$Name
switch ($Kind) {
'String' { return [string]$actual -ceq [string]$Expected }
'ExpandString' { return [string]$actual -ceq [string]$Expected }
'DWord' { return [uint32]$actual -eq [uint32]$Expected }
'QWord' {
$actualBits = if ($actual -is [uint64]) { $actual } else { [BitConverter]::ToUInt64([BitConverter]::GetBytes([int64]$actual), 0) }
$expectedBits = if ($Expected -is [uint64]) { $Expected } else { [BitConverter]::ToUInt64([BitConverter]::GetBytes([int64]$Expected), 0) }
return $actualBits -eq $expectedBits
}
'MultiString' {
$actualArray = @($actual)
$expectedArray = @($Expected)
if ($actualArray.Count -ne $expectedArray.Count) { return $false }
for ($index = 0; $index -lt $actualArray.Count; $index++) {
if ([string]$actualArray[$index] -cne [string]$expectedArray[$index]) { return $false }
}
return $true
}
'Binary' {
$actualArray = [byte[]]$actual
$expectedArray = [byte[]]$Expected
if ($actualArray.Length -ne $expectedArray.Length) { return $false }
for ($index = 0; $index -lt $actualArray.Length; $index++) {
if ($actualArray[$index] -ne $expectedArray[$index]) { return $false }
}
return $true
}
default { return [string]$actual -ceq [string]$Expected }
}
}
# Policy: Configure maintenance windows for automatic updates
# Name: MaintenanceWindow
# Scope: Machine
# State: Enabled
# Source: WindowsUpdate.admx
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartDate' -Kind 'DWord' -Expected 1
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\StartDate') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'UpdateActions' -Kind 'DWord' -Expected 0
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\UpdateActions') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartDate' -Kind 'String' -Expected ''
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\StartDate') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartTime' -Kind 'String' -Expected ''
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\StartTime') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DurationHours' -Kind 'DWord' -Expected 2
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\DurationHours') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'RepeatSchedule' -Kind 'DWord' -Expected 0
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\RepeatSchedule') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DailyFrequency' -Kind 'DWord' -Expected 1
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\DailyFrequency') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'WeeklyFrequency' -Kind 'DWord' -Expected 1
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\WeeklyFrequency') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Sunday' -Kind 'DWord' -Expected 1
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\Sunday') | Out-Null
}
$exists = Test-RegistryValueExists -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Monday'
if ($exists) {
$reasons.Add('Value should be absent: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\Monday') | Out-Null
}
$exists = Test-RegistryValueExists -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Tuesday'
if ($exists) {
$reasons.Add('Value should be absent: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\Tuesday') | Out-Null
}
$exists = Test-RegistryValueExists -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Wednesday'
if ($exists) {
$reasons.Add('Value should be absent: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\Wednesday') | Out-Null
}
$exists = Test-RegistryValueExists -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Thursday'
if ($exists) {
$reasons.Add('Value should be absent: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\Thursday') | Out-Null
}
$exists = Test-RegistryValueExists -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Friday'
if ($exists) {
$reasons.Add('Value should be absent: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\Friday') | Out-Null
}
$exists = Test-RegistryValueExists -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Saturday'
if ($exists) {
$reasons.Add('Value should be absent: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\Saturday') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'MonthlySchedule' -Kind 'DWord' -Expected 0
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\MonthlySchedule') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'MonthsFrequency' -Kind 'DWord' -Expected 1
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\MonthsFrequency') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DayOfMonth' -Kind 'DWord' -Expected 1
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\DayOfMonth') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'OccurrenceInMonth' -Kind 'DWord' -Expected 1
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\OccurrenceInMonth') | Out-Null
}
$isMatch = Test-RegistryValueEquals -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DayOfTheWeek' -Kind 'DWord' -Expected 0
if (-not $isMatch) {
$reasons.Add('Value mismatch: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow\DayOfTheWeek') | Out-Null
}
if ($reasons.Count -eq 0) {
Write-Output 'Compliant'
exit 0
}
$reasons | ForEach-Object { Write-Output $_ }
exit 1
Remediation
$ErrorActionPreference = 'Stop'
function Set-RegistryValue {
param(
[Parameter(Mandatory = $true)][string] $Path,
[Parameter(Mandatory = $true)][string] $Name,
[Parameter(Mandatory = $true)][string] $PropertyType,
[Parameter(Mandatory = $true)][object] $Value
)
if (-not (Test-Path -LiteralPath $Path)) {
New-Item -Path $Path -Force | Out-Null
}
New-ItemProperty -LiteralPath $Path -Name $Name -PropertyType $PropertyType -Value $Value -Force | Out-Null
}
function Remove-RegistryValue {
param(
[Parameter(Mandatory = $true)][string] $Path,
[Parameter(Mandatory = $true)][string] $Name
)
if (Test-Path -LiteralPath $Path) {
Remove-ItemProperty -LiteralPath $Path -Name $Name -Force -ErrorAction SilentlyContinue
}
}
function Clear-RegistryKeyValues {
param(
[Parameter(Mandatory = $true)][string] $Path
)
if (-not (Test-Path -LiteralPath $Path)) {
return
}
foreach ($propertyName in (Get-Item -LiteralPath $Path).Property) {
Remove-ItemProperty -LiteralPath $Path -Name $propertyName -Force -ErrorAction SilentlyContinue
}
}
# Policy: Configure maintenance windows for automatic updates
# Name: MaintenanceWindow
# Scope: Machine
# State: Enabled
# Source: WindowsUpdate.admx
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartDate' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'UpdateActions' -PropertyType 'DWord' -Value 0
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartDate' -PropertyType 'String' -Value ''
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'StartTime' -PropertyType 'String' -Value ''
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DurationHours' -PropertyType 'DWord' -Value 2
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'RepeatSchedule' -PropertyType 'DWord' -Value 0
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DailyFrequency' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'WeeklyFrequency' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Sunday' -PropertyType 'DWord' -Value 1
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Monday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Tuesday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Wednesday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Thursday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Friday'
Remove-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'Saturday'
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'MonthlySchedule' -PropertyType 'DWord' -Value 0
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'MonthsFrequency' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DayOfMonth' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'OccurrenceInMonth' -PropertyType 'DWord' -Value 1
Set-RegistryValue -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow' -Name 'DayOfTheWeek' -PropertyType 'DWord' -Value 0
History 5 retained releases
- 2025 · 4.013 Mar 2026Registry key:
Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow· Value name:StartDate- Removed from the templates.
- 2025 · 3.027 Oct 2025Registry key:
Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow· Value name:StartDate- Added in this release.
Template
- Internal name
MaintenanceWindow- Namespace
Microsoft.Policies.WindowsUpdate- Template file
WindowsUpdate.admx- Release
- Windows Server 2025 2025 · 3.0 · file set
5f3a1e0795443f60…
Definition, editor controls and support
Definition
<policy class="Machine" displayName="$(string.MaintenanceWindow_Title)" explainText="$(string.MaintenanceWindow_Help)" key="Software\Policies\Microsoft\Windows\WindowsUpdate\MaintenanceWindow" name="MaintenanceWindow" presentation="$(presentation.MaintenanceWindow_Title)" valueName="StartDate" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<parentCategory ref="Microsoft.Policies.WindowsUpdate:WindowsUpdateExperience" />
<supportedOn ref="Microsoft.Policies.WindowsUpdate:WU_SUPPORTED_Win11_24H2" />
<enabledValue>
<decimal value="1" />
</enabledValue>
<disabledValue>
<decimal value="0" />
</disabledValue>
<elements>
<enum id="MaintenanceWindowUpdateActionID" required="false" valueName="UpdateActions">
<item displayName="$(string.MaintenanceWindowUpdateAction_DownloadInstallRestart)">
<value>
<decimal value="0" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowUpdateAction_InstallRestart)">
<value>
<decimal value="1" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowUpdateAction_RestartOnly)">
<value>
<decimal value="2" />
</value>
</item>
</enum>
<text id="MaintenanceWindowStartDateID" valueName="StartDate" />
<text id="MaintenanceWindowStartTimeID" valueName="StartTime" />
<decimal id="MaintenanceWindowDuration_Hours" valueName="DurationHours" />
<enum id="MaintenanceWindowRepeatScheduleOption" required="false" valueName="RepeatSchedule">
<item displayName="$(string.MaintenanceWindowRepeatSchedule_None)">
<value>
<decimal value="0" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowRepeatSchedule_Daily)">
<value>
<decimal value="1" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowRepeatSchedule_Weekly)">
<value>
<decimal value="2" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowRepeatSchedule_Monthly)">
<value>
<decimal value="3" />
</value>
</item>
</enum>
<decimal id="MaintenanceWindowDailyFrequencyID" valueName="DailyFrequency" />
<decimal id="MaintenanceWindowWeeklyFrequencyID" valueName="WeeklyFrequency" />
<boolean id="MaintenanceWindowSunday" valueName="Sunday" />
<boolean id="MaintenanceWindowMonday" valueName="Monday" />
<boolean id="MaintenanceWindowTuesday" valueName="Tuesday" />
<boolean id="MaintenanceWindowWednesday" valueName="Wednesday" />
<boolean id="MaintenanceWindowThursday" valueName="Thursday" />
<boolean id="MaintenanceWindowFriday" valueName="Friday" />
<boolean id="MaintenanceWindowSaturday" valueName="Saturday" />
<enum id="MaintenanceWindowMonthlyScheduleID" required="false" valueName="MonthlySchedule">
<item displayName="$(string.MaintenanceWindowMonthlySchedule_MonthBased)">
<value>
<decimal value="0" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowMonthlySchedule_WeekBased)">
<value>
<decimal value="1" />
</value>
</item>
</enum>
<decimal id="MaintenanceWindowMonthsFrequencyID" valueName="MonthsFrequency" />
<decimal id="MaintenanceWindowDayOfMonthID" valueName="DayOfMonth" />
<enum id="MaintenanceWindowOccurrenceInMonth" required="false" valueName="OccurrenceInMonth">
<item displayName="$(string.MaintenanceWindowOccurrenceInMonth_First)">
<value>
<decimal value="1" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowOccurrenceInMonth_Second)">
<value>
<decimal value="2" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowOccurrenceInMonth_Third)">
<value>
<decimal value="3" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowOccurrenceInMonth_Fourth)">
<value>
<decimal value="4" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowOccurrenceInMonth_Last)">
<value>
<decimal value="5" />
</value>
</item>
</enum>
<enum id="MaintenanceWindowDayOfTheWeek" required="false" valueName="DayOfTheWeek">
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Sunday)">
<value>
<decimal value="0" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Monday)">
<value>
<decimal value="1" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Tuesday)">
<value>
<decimal value="2" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Wednesday)">
<value>
<decimal value="3" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Thursday)">
<value>
<decimal value="4" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Friday)">
<value>
<decimal value="5" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Saturday)">
<value>
<decimal value="6" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Weekdays)">
<value>
<decimal value="7" />
</value>
</item>
<item displayName="$(string.MaintenanceWindowDayOfTheWeek_Weekends)">
<value>
<decimal value="8" />
</value>
</item>
</enum>
</elements>
</policy>Editor controls
<presentation id="MaintenanceWindow_Title" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<text>Maintenance Window:</text>
<dropdownList defaultItem="0" noSort="true" refId="MaintenanceWindowUpdateActionID">Update actions only allowed inside the maintenance window:</dropdownList>
<textBox refId="MaintenanceWindowStartDateID">
<label>Start date (Format: yyyy-mm-dd example: 2025-10-30)</label>
</textBox>
<textBox refId="MaintenanceWindowStartTimeID">
<label>Start time (Format: hh:mm example: 23:30 for 11:30 PM)</label>
</textBox>
<decimalTextBox defaultValue="2" refId="MaintenanceWindowDuration_Hours">Duration (hours):</decimalTextBox>
<dropdownList defaultItem="0" noSort="true" refId="MaintenanceWindowRepeatScheduleOption">Select repeat schedule:</dropdownList>
<text>The following settings are only required and applicable if Daily is selected:</text>
<decimalTextBox defaultValue="1" refId="MaintenanceWindowDailyFrequencyID"> Days interval (days):</decimalTextBox>
<text>The following settings are only required and applicable if Weekly is selected:</text>
<decimalTextBox defaultValue="1" refId="MaintenanceWindowWeeklyFrequencyID">Weeks interval (weeks):</decimalTextBox>
<checkBox defaultChecked="true" refId="MaintenanceWindowSunday">Sunday</checkBox>
<checkBox defaultChecked="false" refId="MaintenanceWindowMonday">Monday</checkBox>
<checkBox defaultChecked="false" refId="MaintenanceWindowTuesday">Tuesday</checkBox>
<checkBox defaultChecked="false" refId="MaintenanceWindowWednesday">Wednesday</checkBox>
<checkBox defaultChecked="false" refId="MaintenanceWindowThursday">Thursday</checkBox>
<checkBox defaultChecked="false" refId="MaintenanceWindowFriday">Friday</checkBox>
<checkBox defaultChecked="false" refId="MaintenanceWindowSaturday">Saturday</checkBox>
<text> The following settings are only required and applicable if Monthly is selected:</text>
<dropdownList defaultItem="0" noSort="true" refId="MaintenanceWindowMonthlyScheduleID">Monthly Schedule Type:</dropdownList>
<decimalTextBox defaultValue="1" refId="MaintenanceWindowMonthsFrequencyID">Months Interval (months):</decimalTextBox>
<text>The following settings are only required and applicable if Month-based type is selected:</text>
<decimalTextBox defaultValue="1" refId="MaintenanceWindowDayOfMonthID">Day of the Month:</decimalTextBox>
<text>The following settings are only required and applicable if Week-based type is selected:</text>
<dropdownList defaultItem="0" noSort="true" refId="MaintenanceWindowOccurrenceInMonth">Occurrence in Month</dropdownList>
<dropdownList defaultItem="0" noSort="true" refId="MaintenanceWindowDayOfTheWeek">Day of the Week</dropdownList>
</presentation>Supported platforms and category
Microsoft.Policies.Windows:category:WindowsComponents
<category displayName="$(string.WindowsComponents)" explainText="$(string.WindowsComponents_Help)" name="WindowsComponents" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions" />
Microsoft.Policies.WindowsUpdate:category:WindowsUpdateCat
<category displayName="$(string.WindowsUpdateCat)" name="WindowsUpdateCat" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<parentCategory ref="Microsoft.Policies.Windows:WindowsComponents" />
</category>
Microsoft.Policies.WindowsUpdate:category:WindowsUpdateExperience
<category displayName="$(string.WindowsUpdateExperience)" name="WindowsUpdateExperience" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<parentCategory ref="Microsoft.Policies.WindowsUpdate:WindowsUpdateCat" />
</category>
Microsoft.Policies.WindowsUpdate:definition:WU_SUPPORTED_Win11_24H2
<definition displayName="$(string.WU_SUPPORTED_Win11_24H2)" name="WU_SUPPORTED_Win11_24H2" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<or>
<range minVersionIndex="13" ref="unresolved(products):MicrosoftWindows" />
</or>
</definition>
Microsoft.Policies.WindowsUpdate:unresolved:unresolved(products):MicrosoftWindows
<unresolved reference="unresolved(products):MicrosoftWindows" />
Microsoft.Policies.Windows:category:WindowsComponents
<category displayName="$(string.WindowsComponents)" explainText="$(string.WindowsComponents_Help)" name="WindowsComponents" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions" />
<strings><string id="Microsoft.Policies.Windows:WindowsComponents">Windows Components</string><string id="Microsoft.Policies.Windows:WindowsComponents_Help">Contains settings for operating system components.</string></strings>
Microsoft.Policies.WindowsUpdate:category:WindowsUpdateCat
<category displayName="$(string.WindowsUpdateCat)" name="WindowsUpdateCat" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<parentCategory ref="Microsoft.Policies.Windows:WindowsComponents" />
</category>
<strings><string id="Microsoft.Policies.WindowsUpdate:WindowsUpdateCat">Windows Update</string></strings>
Microsoft.Policies.WindowsUpdate:category:WindowsUpdateExperience
<category displayName="$(string.WindowsUpdateExperience)" name="WindowsUpdateExperience" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<parentCategory ref="Microsoft.Policies.WindowsUpdate:WindowsUpdateCat" />
</category>
<strings><string id="Microsoft.Policies.WindowsUpdate:WindowsUpdateExperience">Manage end user experience</string></strings>
Microsoft.Policies.WindowsUpdate:definition:WU_SUPPORTED_Win11_24H2
<definition displayName="$(string.WU_SUPPORTED_Win11_24H2)" name="WU_SUPPORTED_Win11_24H2" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<or>
<range minVersionIndex="13" ref="unresolved(products):MicrosoftWindows" />
</or>
</definition>
<strings><string id="Microsoft.Policies.WindowsUpdate:WU_SUPPORTED_Win11_24H2">At least Windows 11 Version 24H2</string></strings>