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 (-not (Test-Admin)) {
Invoke-OneShot DisableUAC;
Restart-Computer;
Restart-Intermediate -NoRegister;
return;
}

View file

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