From 1fbc33cf88e4e1e365932666c72db5c2f6c60a17 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 12 Aug 2024 21:32:53 +0200 Subject: [PATCH] Ensure auto reboot is disabled properly --- scripts/Windows/Scripts/Registry.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/Windows/Scripts/Registry.ps1 b/scripts/Windows/Scripts/Registry.ps1 index 2d63e659..6a7e040d 100644 --- a/scripts/Windows/Scripts/Registry.ps1 +++ b/scripts/Windows/Scripts/Registry.ps1 @@ -61,9 +61,12 @@ $null = New-Module { Disables automatic reboots by Windows Update. #> function Disable-WindowsUpdateAutoRestart { - Set-ItemProperty "$wuPolicyPath\AU" ` + $path = "$wuPolicyPath\AU"; + $null = New-Item -Force $path -ErrorAction SilentlyContinue; + + Set-ItemProperty $path ` -Name NoAutoRebootWithLoggedOnUsers ` - -Value $Value; + -Value 1; } <#