Allow registering startup script for the default user

This commit is contained in:
Manuel Thalmann 2024-08-21 18:20:11 +02:00
parent 18abc9e499
commit 682571eeba

View file

@ -70,6 +70,8 @@ $null = New-Module {
param(
[Parameter(ParameterSetName="System")]
[switch] $System,
[Parameter(ParameterSetName="DefaultUser", Mandatory)]
[switch] $DefaultUser,
[Parameter(ParameterSetName="User", Mandatory)]
[switch] $User,
[Parameter(ParameterSetName="User")]
@ -77,6 +79,18 @@ $null = New-Module {
[RegistryKey] $UserKey
)
if ($DefaultUser.IsPresent) {
Edit-DefaultUserKey {
param(
[RegistryKey] $Key
)
Register-Setup -UserKey $Key;
}
return;
}
if ($User.IsPresent -or $UserKey) {
if (-not $UserKey) {
$UserKey = Get-Item "HKCU:\";
@ -159,15 +173,9 @@ $null = New-Module {
[switch] $CurrentUser
)
if ($DefaultUser.ToBool()) {
Edit-DefaultUserKey {
param(
[RegistryKey] $Key
)
Register-Setup -UserKey $Key;
}
} elseif ($CurrentUser.ToBool()) {
if ($DefaultUser.IsPresent) {
Register-Setup -DefaultUser;
} elseif ($CurrentUser.IsPresent) {
Register-Setup -User;
} else {
Register-Setup;