Allow registering reboots for users

This commit is contained in:
Manuel Thalmann 2024-08-19 01:37:14 +02:00
parent 19e84bd4ab
commit 141b8290da

View file

@ -153,12 +153,15 @@ $null = New-Module {
#>
function Restart-Intermediate {
param(
[switch] $DefaultUser
[Parameter(ParameterSetName="Default", Mandatory)]
[switch] $DefaultUser,
[Parameter(ParameterSetName="Current", Mandatory)]
[switch] $CurrentUser
)
$register = { param($UserKey) Register-Setup @PSBoundParameters; };
if ($DefaultUser) {
if ($DefaultUser.ToBool()) {
Edit-DefaultUserKey {
param(
[RegistryKey] $Key
@ -166,6 +169,8 @@ $null = New-Module {
& $register $Key;
}
} elseif ($CurrentUser.ToBool()) {
& $register (Get-Item HKCU:\);
} else {
& $register;
}