Allow skipping the User parameter

This commit is contained in:
Manuel Thalmann 2024-08-10 03:40:37 +02:00
parent c347ff6377
commit 52c5a6c6a3

View file

@ -75,13 +75,14 @@ $null = New-Module {
param( param(
[Parameter(ParameterSetName="System")] [Parameter(ParameterSetName="System")]
[switch] $System, [switch] $System,
[Parameter(ParameterSetName="User",Mandatory)] [Parameter(ParameterSetName="User", Mandatory)]
[switch] $User, [switch] $User,
[Parameter(ParameterSetName="User")] [Parameter(ParameterSetName="User")]
[Parameter(ParameterSetName="SpecificUser", Mandatory)]
[RegistryKey] $UserKey [RegistryKey] $UserKey
) )
if ($User.IsPresent) { if ($User.IsPresent -or $UserKey) {
if (-not $UserKey) { if (-not $UserKey) {
$UserKey = Get-Item "HKCU:\"; $UserKey = Get-Item "HKCU:\";
} }