From 3d23ce78bcad87357d90369be1dc303febbacdd8 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 16 Jul 2023 11:30:20 +0200 Subject: [PATCH] Always forcefully restart computer --- profiles/DerGeret/Windows/Restore.ps1 | 2 +- scripts/Windows/OS/User.ps1 | 2 +- scripts/Windows/Scripts/Context.ps1 | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/profiles/DerGeret/Windows/Restore.ps1 b/profiles/DerGeret/Windows/Restore.ps1 index 6d287288..dac5225d 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; -$context.RestartComputer(); +Restart-Computer -Force; diff --git a/scripts/Windows/OS/User.ps1 b/scripts/Windows/OS/User.ps1 index ff3e733f..e1ba2ced 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"); - $context.RestartComputer(); + Restart-Computer -Force; exit; } elseif ($context.GetStage() -eq "DisableUAC") diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1 index ce43ab26..b6c99c49 100644 --- a/scripts/Windows/Scripts/Context.ps1 +++ b/scripts/Windows/Scripts/Context.ps1 @@ -284,14 +284,11 @@ class Context { [void] Reboot() { Write-Host "Restarting Computer..."; $this.RegisterReboot(); - $this.RestartComputer(); + Restart-Computer -Force; exit; } [void] RestartComputer() { - Restart-Computer; - Start-Sleep 60; - Restart-Computer -Force; } [void] Cleanup() {