How to Force Windows Update to “Install Updates and Restart” Instead of “Install and Shutdown” for Remote Management


2 views

When managing Windows systems remotely, the default shutdown-with-updates behavior creates unnecessary downtime. Unlike physical workstations where you might prefer shutdown after updates, servers and remote machines typically need to come back online automatically.

The most reliable method is using PowerShell commands to modify update behavior:


# Check current restart settings
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption"

# Set to always restart (value 1 = restart, 0 = shutdown)
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Value 1

# Alternative method using Group Policy (requires admin)
Start-Process "gpedit.msc"
# Navigate to: Computer Configuration > Administrative Templates > Windows Components > Windows Update
# Enable "Do not display 'Install Updates and Shut Down' option in Shut Down Windows dialog box"

For systems without Group Policy access, directly edit the registry:


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings]
"UxOption"=dword:00000001

Save as force_restart.reg and merge, then reboot for changes to take effect.

For environments with strict change control, create a scheduled task that triggers after updates:


$trigger = New-ScheduledTaskTrigger -AtLogOn
$action = New-ScheduledTaskAction -Execute "shutdown.exe" -Argument "/r /t 60 /c ""Forced restart after updates"""
Register-ScheduledTask -TaskName "Post-Update Restart" -Trigger $trigger -Action $action -RunLevel Highest

For programmatic control in applications:


using WUApiLib;

public class UpdateInstaller
{
    public static void InstallAndRestart()
    {
        UpdateSession session = new UpdateSession();
        IUpdateSearcher searcher = session.CreateUpdateSearcher();
        ISearchResult results = searcher.Search("IsInstalled=0");
        
        UpdateCollection updates = results.Updates;
        UpdateInstaller installer = session.CreateUpdateInstaller();
        installer.Updates = updates;
        installer.AllowSourcePrompts = false;
        installer.ForceQuiet = true;
        installer.RebootRequired += (sender, args) => 
        {
            System.Diagnostics.Process.Start("shutdown.exe", "/r /t 0");
        };
        
        IInstallationResult installResult = installer.Install();
    }
}
  • Combine with WSUS or Windows Update for Business for centralized control
  • Set maintenance windows using Task Scheduler
  • Implement proper monitoring to verify successful restarts
  • Consider using Azure Update Management for hybrid environments

If changes don't take effect:

  1. Verify you're modifying the correct registry hive (HKLM vs HKCU)
  2. Check for conflicting Group Policy settings
  3. Ensure the Windows Update service is running
  4. Look for pending reboots that might be blocking changes

When managing Windows machines remotely, the default "Install and shutdown" behavior creates operational headaches. For servers and workstations accessed via RDP or PowerShell Remoting, we need the system to automatically reboot after updates to complete the installation cycle.

For Windows 10/11 and Server 2016+, use this PowerShell command to modify the restart behavior:


# Set active hours to prevent unexpected reboots (optional)
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "ActiveHoursStart" -Value 8
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "ActiveHoursEnd" -Value 17

# Force "Install updates and restart" behavior
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AlwaysAutoRebootAtScheduledTime" -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AlwaysAutoRebootAtScheduledTimeMode" -Value 2

# Apply changes (no reboot needed)
Restart-Service wuauserv

For domain-managed machines:

  1. Open gpedit.msc
  2. Navigate to: Computer Configuration > Administrative Templates > Windows Components > Windows Update
  3. Enable "Always automatically restart at the scheduled time"
  4. Set "Always automatically restart at the scheduled time" to "2 - Auto reboot with warning"

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
"AlwaysAutoRebootAtScheduledTime"=dword:00000001
"AlwaysAutoRebootAtScheduledTimeMode"=dword:00000002

Check current settings with this PowerShell snippet:


$rebootBehavior = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AlwaysAutoRebootAtScheduledTimeMode" -ErrorAction SilentlyContinue

if ($rebootBehavior.AlwaysAutoRebootAtScheduledTimeMode -eq 2) {
    Write-Host "System configured for 'Install updates and restart'" -ForegroundColor Green
} else {
    Write-Host "Current configuration: $($rebootBehavior.AlwaysAutoRebootAtScheduledTimeMode)" -ForegroundColor Yellow
}
  • These changes require administrative privileges
  • Windows 10 Pro/Enterprise and Windows Server editions only
  • For Azure VMs, consider using Update Management Center
  • Combine with Wake-on-LAN for completely hands-off patching