Always forcefully restart computer as backup plan

This commit is contained in:
Manuel Thalmann 2023-07-16 11:21:58 +02:00
parent 6d516378e2
commit d04514a34e
3 changed files with 7 additions and 3 deletions

View file

@ -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();

View file

@ -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")

View file

@ -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() {