diff --git a/Default.preset b/Default.preset index 4911238..84a95cc 100644 --- a/Default.preset +++ b/Default.preset @@ -80,6 +80,7 @@ DisableRemoteAssistance # EnableRemoteAssistance # DisableUpdateDriver # EnableUpdateDriver EnableUpdateMSProducts # DisableUpdateMSProducts # DisableUpdateAutoDownload # EnableUpdateAutoDownload +DisableUpdateRestart # EnableUpdateRestart DisableMaintenanceWakeUp # EnableMaintenanceWakeUp DisableSharedExperiences # EnableSharedExperiences # EnableClipboardHistory # DisableClipboardHistory diff --git a/Win10.psm1 b/Win10.psm1 index a4b5c1f..1650aa5 100644 --- a/Win10.psm1 +++ b/Win10.psm1 @@ -1206,6 +1206,23 @@ Function EnableUpdateAutoDownload { Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -ErrorAction SilentlyContinue } +# Disable automatic restart after Windows Update installation +# The tweak is slightly experimental, as it registers a dummy debugger for MusNotification.exe +# which blocks the restart prompt executable from running, thus never schedulling the restart +Function DisableUpdateRestart { + Write-Output "Disabling Windows Update automatic restart..." + If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe")) { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe" -Force | Out-Null + } + Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe" -Name "Debugger" -Type String -Value "cmd.exe" +} + +# Enable automatic restart after Windows Update installation +Function EnableUpdateRestart { + Write-Output "Enabling Windows Update automatic restart..." + Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe" -Name "Debugger" -ErrorAction SilentlyContinue +} + # Disable nightly wake-up for Automatic Maintenance and Windows Updates Function DisableMaintenanceWakeUp { Write-Output "Disabling nightly wake-up for Automatic Maintenance..."