Simplify script registration

This commit is contained in:
Manuel Thalmann 2024-08-19 02:24:13 +02:00
parent 8a59b54295
commit 76da967793

View file

@ -159,20 +159,18 @@ $null = New-Module {
[switch] $CurrentUser
)
$register = { param($UserKey) Register-Setup @PSBoundParameters; };
if ($DefaultUser.ToBool()) {
Edit-DefaultUserKey {
param(
[RegistryKey] $Key
)
& $register $Key;
Register-Setup -UserKey $Key;
}
} elseif ($CurrentUser.ToBool()) {
& $register (Get-Item HKCU:\);
Register-Setup -User;
} else {
& $register;
Register-Setup;
}
Restart-Computer -Force;