Allow rebooting without registering setup

This commit is contained in:
Manuel Thalmann 2024-08-27 03:11:35 +02:00
parent 2220ca3138
commit e1b6038f4c
2 changed files with 12 additions and 8 deletions

View file

@ -596,7 +596,7 @@ $null = New-Module {
if ($msAccount) { if ($msAccount) {
if (-not (Test-Admin)) { if (-not (Test-Admin)) {
Invoke-OneShot DisableUAC; Invoke-OneShot DisableUAC;
Restart-Computer; Restart-Intermediate -NoRegister;
return; return;
} }

View file

@ -166,18 +166,22 @@ $null = New-Module {
#> #>
function Restart-Intermediate { function Restart-Intermediate {
param( param(
[Parameter(ParameterSetName="Default")] [Parameter(ParameterSetName="None")]
[switch] $NoRegister,
[Parameter(ParameterSetName="Default", Mandatory)]
[switch] $DefaultUser, [switch] $DefaultUser,
[Parameter(ParameterSetName="Current", Mandatory)] [Parameter(ParameterSetName="Current", Mandatory)]
[switch] $CurrentUser [switch] $CurrentUser
) )
if ($DefaultUser.IsPresent) { if (-not $NoRegister.IsPresent) {
Register-Setup -DefaultUser; if ($DefaultUser.IsPresent) {
} elseif ($CurrentUser.IsPresent) { Register-Setup -DefaultUser;
Register-Setup -User; } elseif ($CurrentUser.IsPresent) {
} else { Register-Setup -User;
Register-Setup; } else {
Register-Setup;
}
} }
Restart-Computer -Force; Restart-Computer -Force;