Always forcefully restart computer as backup plan
This commit is contained in:
parent
93b41e9f0a
commit
126c130f83
3 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||||
Restart-Computer;
|
$context.RestartComputer();
|
||||||
|
|
|
@ -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");
|
||||||
Restart-Computer;
|
$context.RestartComputer();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
elseif ($context.GetStage() -eq "DisableUAC")
|
elseif ($context.GetStage() -eq "DisableUAC")
|
||||||
|
|
|
@ -284,10 +284,14 @@ class Context {
|
||||||
[void] Reboot() {
|
[void] Reboot() {
|
||||||
Write-Host "Restarting Computer...";
|
Write-Host "Restarting Computer...";
|
||||||
$this.RegisterReboot();
|
$this.RegisterReboot();
|
||||||
|
$this.RestartComputer();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
[void] RestartComputer() {
|
||||||
Restart-Computer;
|
Restart-Computer;
|
||||||
Start-Sleep 60;
|
Start-Sleep 60;
|
||||||
Restart-Computer -Force;
|
Restart-Computer -Force;
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[void] Cleanup() {
|
[void] Cleanup() {
|
||||||
|
|
Loading…
Reference in a new issue