Allow rebooting without registering setup
This commit is contained in:
parent
2220ca3138
commit
e1b6038f4c
2 changed files with 12 additions and 8 deletions
|
@ -596,7 +596,7 @@ $null = New-Module {
|
|||
if ($msAccount) {
|
||||
if (-not (Test-Admin)) {
|
||||
Invoke-OneShot DisableUAC;
|
||||
Restart-Computer;
|
||||
Restart-Intermediate -NoRegister;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -166,18 +166,22 @@ $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 ($DefaultUser.IsPresent) {
|
||||
Register-Setup -DefaultUser;
|
||||
} elseif ($CurrentUser.IsPresent) {
|
||||
Register-Setup -User;
|
||||
} else {
|
||||
Register-Setup;
|
||||
if (-not $NoRegister.IsPresent) {
|
||||
if ($DefaultUser.IsPresent) {
|
||||
Register-Setup -DefaultUser;
|
||||
} elseif ($CurrentUser.IsPresent) {
|
||||
Register-Setup -User;
|
||||
} else {
|
||||
Register-Setup;
|
||||
}
|
||||
}
|
||||
|
||||
Restart-Computer -Force;
|
||||
|
|
Loading…
Reference in a new issue