Always forcefully restart computer

This commit is contained in:
Manuel Thalmann 2023-07-16 11:30:20 +02:00
parent d04514a34e
commit 1654869529
3 changed files with 3 additions and 6 deletions

View file

@ -9,4 +9,4 @@ Write-Host "Starting Restoration of Windows";
$context.EntryPoint = "$($MyInvocation.MyCommand.Path)"; $context.EntryPoint = "$($MyInvocation.MyCommand.Path)";
$context.UserName = "Manuel"; $context.UserName = "Manuel";
Invoke-WindowsInstallation $context; Invoke-WindowsInstallation $context;
$context.RestartComputer(); Restart-Computer -Force;

View file

@ -46,7 +46,7 @@ function New-PersonalUser([Context] $context)
Write-Information "Disabling Auto login"; Write-Information "Disabling Auto login";
$context.RemoveAutologin(); $context.RemoveAutologin();
$context.SetStage("DisableUAC"); $context.SetStage("DisableUAC");
$context.RestartComputer(); Restart-Computer -Force;
exit; exit;
} }
elseif ($context.GetStage() -eq "DisableUAC") elseif ($context.GetStage() -eq "DisableUAC")

View file

@ -284,14 +284,11 @@ class Context {
[void] Reboot() { [void] Reboot() {
Write-Host "Restarting Computer..."; Write-Host "Restarting Computer...";
$this.RegisterReboot(); $this.RegisterReboot();
$this.RestartComputer(); Restart-Computer -Force;
exit; exit;
} }
[void] RestartComputer() { [void] RestartComputer() {
Restart-Computer;
Start-Sleep 60;
Restart-Computer -Force;
} }
[void] Cleanup() { [void] Cleanup() {