Unattended Updates on Windows Server¶
Windows Server patches through the Windows Update Agent (WUA), the same engine as the Windows client. What changes between environments is where updates come from (Microsoft Update, WSUS, Configuration Manager, Azure Update Manager) and how the agent is told to behave (sconfig, Group Policy, registry, MDM, or an orchestration tool).
This guide covers Windows Server 2016, 2019, 2022 and 2025 — Desktop Experience and Server Core.
Contents¶
- Decide on a patching model first
- Quick start: sconfig
- Group Policy (the canonical method)
- Registry equivalents (workgroup / no GPO)
- Pointing servers at WSUS
- Scripted installs with PowerShell
- Azure Update Manager (Azure + Arc)
- Hotpatch (rebootless security updates)
- Failover clusters: Cluster-Aware Updating
- Controlling reboots
- Verification, logs and troubleshooting
- Recommended baselines by server role
Decide on a patching model first¶
| Model | Source | Who decides what installs | Good for |
|---|---|---|---|
| Automatic from Microsoft Update | Internet | Microsoft (everything released) | Standalone / small fleets, lab, edge |
| WSUS + GPO | Internal WSUS | You (approvals) | On-prem fleets needing approval gates |
| Configuration Manager (MECM) | Distribution points | You (deployments, maintenance windows) | Large enterprises already on MECM |
| Azure Update Manager | Microsoft Update / WSUS | You (schedules, classifications) | Azure VMs and Arc-connected servers anywhere |
| Hotpatch | Microsoft Update via Azure/Arc | Microsoft (security only) + quarterly baseline | Windows Server 2025 / Azure Edition, minimising reboots |
WSUS status: Microsoft deprecated WSUS in September 2024. It is still shipped and supported (including in Windows Server 2025) but receives no new features. New designs should lean towards Azure Update Manager, MECM or Intune-style cloud management; existing WSUS deployments keep working.
Whatever you choose, only one thing should be in charge of a given server. A server with a GPO pointing at WSUS and an Azure Update Manager schedule and a scheduled PSWindowsUpdate task will behave unpredictably.
Quick start: sconfig¶
sconfig is available on both Server Core and Desktop Experience. On 2022 and 2025 it is PowerShell-based; on 2016/2019 it is the older VBScript menu, but option numbers are the same.
sconfig
# 5) Update setting
# A = Automatic (download and install on schedule)
# D = DownloadOnly
# M = Manual
Choosing Automatic sets AUOptions to 4 (auto download + schedule install) with the default schedule of every day at 03:00. For anything beyond that, use Group Policy or the registry.
sconfig option 6 ("Install updates") does an interactive one-off scan and install — useful for first boot, not for unattended operation.
If a GPO is applied, sconfig shows the setting as managed by policy and changes made in sconfig will be overwritten at the next policy refresh.
Group Policy (the canonical method)¶
Path:
Computer Configuration
└─ Administrative Templates
└─ Windows Components
└─ Windows Update
└─ (2022/2025 templates: "Manage end user experience" / "Manage updates offered from Windows Server Update Service")
Core settings¶
| Policy | Recommended value (unattended) | Notes |
|---|---|---|
| Configure Automatic Updates | Enabled, 4 – Auto download and schedule the install | Option 7 (Server 2016+) = auto download, notify to install, notify to restart — not unattended |
| Scheduled install day | 0 – Every day or a specific weekday |
|
| Scheduled install time | e.g. 03:00 |
Pair with a maintenance window |
| Install updates for other Microsoft products | Enabled (if you want SQL, .NET, etc.) | Same as "Give me updates for other Microsoft products" |
| Specify intranet Microsoft update service location | Only if using WSUS | See WSUS section |
| Automatic Updates detection frequency | 4–22 hours | Default is 22 hours |
| No auto-restart with logged on users for scheduled automatic updates installations | Disabled for true unattended | When Enabled, an RDP session left open blocks the reboot indefinitely |
| Always automatically restart at the scheduled time | Enabled, 15–180 minute timer | Forces reboot after install |
| Do not connect to any Windows Update Internet locations | Enabled when using WSUS | Stops fallback to the internet |
| Enable client-side targeting | Enabled + group name (WSUS) | Puts the server into a WSUS computer group automatically |
Apply and verify¶
gpupdate /force
gpresult /h C:\Temp\gp.html # check the Windows Update policies were applied
Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
Staggering with multiple GPOs¶
A common pattern is three OUs or security-filtered GPOs:
| Ring | Day / time | Members |
|---|---|---|
| Ring 0 – Pilot | Wednesday 02:00 (day after Patch Tuesday) | Non-critical / test servers |
| Ring 1 – Broad | Saturday 03:00 | Most servers |
| Ring 2 – Critical | Sunday 03:00, week after | DCs, SQL, file clusters (one node per GPO) |
Patch Tuesday is the second Tuesday of each month; out-of-band releases happen whenever Microsoft decides.
Registry equivalents (workgroup / no GPO)¶
For non-domain servers, images, or config management (Ansible win_regedit, DSC), write the policy keys directly. These are exactly what the GPO writes.
$au = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
New-Item -Path $au -Force | Out-Null
Set-ItemProperty -Path $au -Name NoAutoUpdate -Value 0 -Type DWord
Set-ItemProperty -Path $au -Name AUOptions -Value 4 -Type DWord # auto download + schedule
Set-ItemProperty -Path $au -Name ScheduledInstallDay -Value 0 -Type DWord # 0 = every day, 1 = Sun ... 7 = Sat
Set-ItemProperty -Path $au -Name ScheduledInstallTime -Value 3 -Type DWord # 0-23
Set-ItemProperty -Path $au -Name AllowMUUpdateService -Value 1 -Type DWord # other Microsoft products
Set-ItemProperty -Path $au -Name NoAutoRebootWithLoggedOnUsers -Value 0 -Type DWord
Set-ItemProperty -Path $au -Name DetectionFrequencyEnabled -Value 1 -Type DWord
Set-ItemProperty -Path $au -Name DetectionFrequency -Value 6 -Type DWord # hours
Restart-Service wuauserv
AUOptions values¶
| Value | Behaviour |
|---|---|
| 2 | Notify before download |
| 3 | Auto download, notify to install |
| 4 | Auto download and schedule install (unattended) |
| 5 | Allow local admin to choose |
| 7 | Auto download, notify to install, notify to restart (Server 2016+) |
Optional week-of-month scheduling (used with ScheduledInstallDay):
Set-ItemProperty -Path $au -Name ScheduledInstallFirstWeek -Value 1 -Type DWord
# also: ScheduledInstallSecondWeek, ScheduledInstallThirdWeek, ScheduledInstallFourthWeek, ScheduledInstallEveryWeek
Pointing servers at WSUS¶
GPO: Specify intranet Microsoft update service location, or registry:
$wu = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate'
Set-ItemProperty -Path $wu -Name WUServer -Value 'https://wsus.corp.example.com:8531'
Set-ItemProperty -Path $wu -Name WUStatusServer -Value 'https://wsus.corp.example.com:8531'
Set-ItemProperty -Path $wu -Name TargetGroupEnabled -Value 1 -Type DWord
Set-ItemProperty -Path $wu -Name TargetGroup -Value 'Servers-Ring1'
Set-ItemProperty -Path $wu -Name DoNotConnectToWindowsUpdateInternetLocations -Value 1 -Type DWord
Set-ItemProperty -Path "$wu\AU" -Name UseWUServer -Value 1 -Type DWord
Restart-Service wuauserv
Notes:
- Use HTTPS (8531). Unencrypted WSUS (8530) is vulnerable to update-spoofing attacks unless you deliberately accept that risk.
- Unattended installs with WSUS still depend on approvals. Use automatic approval rules (e.g. auto-approve Critical + Security for
Servers-Ring0) or nothing will ever install. - Keep the WSUS database lean: decline superseded updates and run the Server Cleanup Wizard (or
Invoke-WsusServerCleanup) on a schedule. A bloated SUSDB is the #1 cause of WSUS clients timing out.
Force a client to check in:
# 2016+
UsoClient StartScan # undocumented but works
# or
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
Scripted installs with PowerShell¶
When you want explicit control (CI-driven patch jobs, Ansible, a scheduled task with logging), drive the WUA yourself.
Option A: PSWindowsUpdate (community module)¶
Install-Module PSWindowsUpdate -Scope AllUsers -Force
Import-Module PSWindowsUpdate
# What's pending?
Get-WindowsUpdate
# Install everything, accept all, reboot if needed, log
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot -Verbose |
Out-File "C:\Logs\wu-$(Get-Date -Format yyyyMMdd).log"
# Security + critical only
Install-WindowsUpdate -Category 'Security Updates','Critical Updates' -AcceptAll -IgnoreReboot
# Exclude a KB
Install-WindowsUpdate -NotKBArticleID KB5012170 -AcceptAll
# Run on remote servers (creates a scheduled task on the target, since WUA refuses remote sessions)
Invoke-WUJob -ComputerName srv01,srv02 -Script {
Import-Module PSWindowsUpdate; Install-WindowsUpdate -AcceptAll -AutoReboot |
Out-File C:\Logs\wu.log
} -RunNow -Confirm:$false
PSWindowsUpdate is third-party (PowerShell Gallery) — vet it like any other dependency.
Option B: raw COM, no dependencies¶
$session = New-Object -ComObject Microsoft.Update.Session
$searcher = $session.CreateUpdateSearcher()
$result = $searcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0")
if ($result.Updates.Count -eq 0) { Write-Output 'No updates'; return }
$toInstall = New-Object -ComObject Microsoft.Update.UpdateColl
foreach ($u in $result.Updates) {
if (-not $u.EulaAccepted) { $u.AcceptEula() }
[void]$toInstall.Add($u)
}
$dl = $session.CreateUpdateDownloader(); $dl.Updates = $toInstall; $dl.Download() | Out-Null
$in = $session.CreateUpdateInstaller(); $in.Updates = $toInstall; $res = $in.Install()
"ResultCode: $($res.ResultCode) RebootRequired: $($res.RebootRequired)"
if ($res.RebootRequired) { Restart-Computer -Force }
The WUA COM API refuses to download/install over a remote PowerShell session (WinRM). Run it locally via a scheduled task (as SYSTEM), or use
Invoke-WUJob, Ansible'swin_updates(which handles this for you), or Azure Update Manager.
Ansible¶
- name: Patch Windows servers
hosts: windows
serial: 1 # one at a time for clustered roles
tasks:
- ansible.windows.win_updates:
category_names: [SecurityUpdates, CriticalUpdates, UpdateRollups]
reboot: true
reboot_timeout: 3600
register: wu
- debug: var=wu.installed_update_count
Azure Update Manager (Azure + Arc)¶
Azure Update Manager (successor to Azure Automation Update Management) schedules patching for Azure VMs and any server connected to Azure Arc — on-prem, VMware, Hyper-V, AWS, GCP — Windows and Linux alike. No Log Analytics agent required.
Key concepts:
- Patch orchestration on the VM/Arc machine must be set to Customer Managed Schedules (Azure VMs) so the platform doesn't patch on its own as well.
- Maintenance configurations define the window (recurrence, duration up to 3h55m), classifications (Critical, Security, Update Rollup, Definition…), KB include/exclude lists and reboot setting (
IfRequired,Never,Always). - Dynamic scopes assign machines to a schedule by subscription / resource group / tag / OS — e.g. tag
PatchRing=1. - Periodic assessment scans every 24 hours for compliance reporting.
Azure CLI sketch:
az maintenance configuration create \
--resource-group rg-patching --resource-name mc-win-ring1 \
--location canadacentral \
--maintenance-scope InGuestPatch \
--maintenance-window-start-date-time "2026-11-14 03:00" \
--maintenance-window-duration "03:00" \
--maintenance-window-recur-every "Week Saturday" \
--maintenance-window-time-zone "Eastern Standard Time" \
--reboot-setting IfRequired \
--windows-parameters classifications-to-include="Critical Security UpdateRollup" \
--extension-properties InGuestPatchMode="User"
Billing: free for Azure VMs; for Arc servers it is billed per server per month unless the server is covered by Windows Server Management enabled by Azure Arc (Software Assurance / pay-as-you-go licensing attestation), Extended Security Updates via Arc, or other included offers. Check current pricing before rolling out to a large on-prem fleet.
Update Manager can also consume WSUS as the source if the server's WU policy points at WSUS — Update Manager then schedules, WSUS still governs approvals.
Hotpatch (rebootless security updates)¶
Hotpatch patches in-memory code of running processes, so most monthly security updates install without a reboot.
| Edition | Where | Requirement | Cost |
|---|---|---|---|
| Windows Server 2022 / 2025 Datacenter: Azure Edition | Azure IaaS, Azure Local | Supported image | Included |
| Windows Server 2025 Standard / Datacenter | On-prem / any cloud | Azure Arc connection + enrollment, VBS enabled | No additional charge since mid-May 2026 (previously $1.50/core/month) |
How the cadence works:
- Baseline months (quarterly — January, April, July, October): a normal cumulative update that requires a reboot.
- Hotpatch months (the other two months in each quarter): security-only hotpatches, no reboot.
- Non-security fixes and some out-of-band fixes can still force an occasional reboot outside baseline months.
Enable (Arc, on-prem):
- Server must be Windows Server 2025 Standard/Datacenter, current cumulative update, Virtualization-Based Security (VBS) running.
- Connect it with the Azure Connected Machine agent.
- Azure portal → Azure Arc → Machines → server → Hotpatch → Confirm.
- Manage scheduling of baseline months with Azure Update Manager (or WSUS/MECM, which are hotpatch-aware).
Hotpatch is the closest Windows gets to Linux livepatching, and it drops typical reboots from 12 per year to 4.
Failover clusters: Cluster-Aware Updating¶
Never let individual cluster nodes auto-reboot on their own schedule — you risk two nodes rebooting at once and losing quorum. Cluster-Aware Updating (CAU) drains roles off a node, patches it, reboots, waits for health, moves roles back, and continues to the next node.
Install-WindowsFeature RSAT-Clustering-PowerShell
# Self-updating mode: the cluster patches itself on a schedule
Add-CauClusterRole -ClusterName CLUSTER01 `
-DaysOfWeek Saturday -WeeksOfMonth 2,4 `
-MaxFailedNodes 0 -MaxRetriesPerNode 2 `
-RequireAllNodesOnline -EnableFirewallRules -Force
# One-off run
Invoke-CauRun -ClusterName CLUSTER01 -MaxFailedNodes 0 -RequireAllNodesOnline -Force
# History
Get-CauReport -ClusterName CLUSTER01 -Last -Detailed
On cluster nodes set Configure Automatic Updates to 3 (download only) or disable it, and let CAU do the install/reboot. CAU uses the Microsoft.WindowsUpdatePlugin by default, so it respects WSUS if configured.
Same principle for other HA roles: AD domain controllers (patch in groups, never all DCs at once), SQL Always On AGs (patch secondaries, fail over, patch old primary), RDS farms (drain mode).
Controlling reboots¶
Unattended patching that never reboots isn't unattended patching — it's a queue of pending updates.
NoAutoRebootWithLoggedOnUsers = 1is the classic trap: a disconnected RDP session blocks reboots forever. Set it to 0 on servers, or enforce RDS session time limits.- Active hours (2016+) prevent automatic restarts during a window; on servers that's usually irrelevant if you schedule installs at night.
- Check for a pending reboot:
function Test-PendingReboot {
$keys = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending',
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'
)
if ($keys | Where-Object { Test-Path $_ }) { return $true }
$pfro = Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' `
-Name PendingFileRenameOperations -ErrorAction SilentlyContinue
return [bool]$pfro
}
Test-PendingReboot
Wire that into monitoring (Prometheus windows_exporter textfile collector, Zabbix, etc.) and alert if a server has been pending reboot for more than N days.
Verification, logs and troubleshooting¶
# Last installed updates
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 10
# Full WU history (includes failures)
$s = New-Object -ComObject Microsoft.Update.Session
$s.CreateUpdateSearcher().QueryHistory(0,50) |
Select-Object Date, Title, @{n='Result';e={$_.ResultCode}} | Format-Table -AutoSize
# Windows Update log (ETW-based since 2016; this converts it to text)
Get-WindowsUpdateLog -LogPath C:\Temp\WindowsUpdate.log
# Event logs
Get-WinEvent -LogName 'Microsoft-Windows-WindowsUpdateClient/Operational' -MaxEvents 50
# Current effective policy
Get-ItemProperty 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate','HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
ResultCode: 2 = Succeeded, 3 = Succeeded with errors, 4 = Failed, 5 = Aborted.
Common fixes¶
| Symptom | Fix |
|---|---|
| Stuck / corrupt update cache | Stop wuauserv, bits, cryptsvc; rename C:\Windows\SoftwareDistribution and C:\Windows\System32\catroot2; start services |
| Component store corruption | DISM /Online /Cleanup-Image /RestoreHealth then sfc /scannow |
| WinSxS growth | DISM /Online /Cleanup-Image /StartComponentCleanup (add /ResetBase only if you never need to uninstall updates) |
0x8024401c / timeouts with WSUS |
WSUS IIS app pool memory limits, SUSDB cleanup/reindex |
0x80244022 |
WSUS app pool stopped / crashed |
| Updates never install, no errors | Check for overlapping management: GPO vs. MECM vs. Update Manager vs. scheduled script |
Microsoft Defender definition updates run on their own schedule (Update-MpSignature, or the Defender GPO "Security Intelligence Updates") and are separate from the cumulative update cycle.
Recommended baselines by server role¶
| Role | Install | Reboot | Mechanism |
|---|---|---|---|
| Stateless web / app (behind LB) | Automatic, daily 03:00 | Automatic | GPO AUOptions 4 or Update Manager; stagger across the pool |
| Domain controllers | Automatic, ring-based | Automatic, one DC at a time per site | Separate GPOs/schedules per DC group |
| SQL Server standalone | Download only | Manual / maintenance window | AUOptions 3 + scripted window |
| SQL Always On / failover clusters | CAU | CAU-managed | Cluster-Aware Updating |
| Hyper-V hosts | CAU (clustered) or drain + scripted | Orchestrated | CAU / MECM / Update Manager |
| Windows Server 2025 on Arc | Hotpatch | Quarterly baselines only | Arc + Update Manager |
| Lab / homelab | Automatic, daily | Automatic | sconfig → A |
References¶
- Microsoft Learn — Configure Windows Update for Business / Group Policy settings for Windows Update
- Microsoft Learn — Windows Server Update Services (WSUS) deprecation
- Microsoft Learn — Azure Update Manager overview
- Microsoft Learn — Hotpatch for Windows Server
- Microsoft Learn — Cluster-Aware Updating overview