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 [switch] $CurrentUser
) )
$register = { param($UserKey) Register-Setup @PSBoundParameters; };
if ($DefaultUser.ToBool()) { if ($DefaultUser.ToBool()) {
Edit-DefaultUserKey { Edit-DefaultUserKey {
param( param(
[RegistryKey] $Key [RegistryKey] $Key
) )
& $register $Key; Register-Setup -UserKey $Key;
} }
} elseif ($CurrentUser.ToBool()) { } elseif ($CurrentUser.ToBool()) {
& $register (Get-Item HKCU:\); Register-Setup -User;
} else { } else {
& $register; Register-Setup;
} }
Restart-Computer -Force; Restart-Computer -Force;