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 ($msAccount) {
|
||||||
if (-not (Test-Admin)) {
|
if (-not (Test-Admin)) {
|
||||||
Invoke-OneShot DisableUAC;
|
Invoke-OneShot DisableUAC;
|
||||||
Restart-Computer;
|
Restart-Intermediate -NoRegister;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue