Automatically restart the computer

This commit is contained in:
Manuel Thalmann 2023-06-22 17:19:00 +02:00
parent f39076dbff
commit ba5fde3d3a

View file

@ -12,6 +12,7 @@ function Invoke-Upgrade([Context] $context)
Write-Debug "A Reboot is Required!"; Write-Debug "A Reboot is Required!";
Write-Debug "Windows will reboot now and the installation will be continued automatically."; Write-Debug "Windows will reboot now and the installation will be continued automatically.";
$null = New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\RunOnce" -Name "PortValhalla" -Value "pwsh `"$($context.EntryPoint)`"" -PropertyType ExpandString; $null = New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\RunOnce" -Name "PortValhalla" -Value "pwsh `"$($context.EntryPoint)`"" -PropertyType ExpandString;
Restart-Computer;
exit; exit;
} }
elseif ((Get-WindowsUpdate).Count -gt 0) elseif ((Get-WindowsUpdate).Count -gt 0)