diff --git a/profiles/DerGeret/Windows/Restore.ps1 b/profiles/DerGeret/Windows/Restore.ps1 index f9fa93aab..6d287288e 100644 --- a/profiles/DerGeret/Windows/Restore.ps1 +++ b/profiles/DerGeret/Windows/Restore.ps1 @@ -9,4 +9,4 @@ Write-Host "Starting Restoration of Windows"; $context.EntryPoint = "$($MyInvocation.MyCommand.Path)"; $context.UserName = "Manuel"; Invoke-WindowsInstallation $context; -Restart-Computer; +$context.RestartComputer(); diff --git a/scripts/Windows/OS/User.ps1 b/scripts/Windows/OS/User.ps1 index 25aa3f105..ff3e733f4 100644 --- a/scripts/Windows/OS/User.ps1 +++ b/scripts/Windows/OS/User.ps1 @@ -46,7 +46,7 @@ function New-PersonalUser([Context] $context) Write-Information "Disabling Auto login"; $context.RemoveAutologin(); $context.SetStage("DisableUAC"); - Restart-Computer; + $context.RestartComputer(); exit; } elseif ($context.GetStage() -eq "DisableUAC") diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1 index 45acbabad..ce43ab261 100644 --- a/scripts/Windows/Scripts/Context.ps1 +++ b/scripts/Windows/Scripts/Context.ps1 @@ -284,10 +284,14 @@ class Context { [void] Reboot() { Write-Host "Restarting Computer..."; $this.RegisterReboot(); + $this.RestartComputer(); + exit; + } + + [void] RestartComputer() { Restart-Computer; Start-Sleep 60; Restart-Computer -Force; - exit; } [void] Cleanup() {