From a219a15a5c0db35a71a8f2a43e68fd114dc2aa07 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 10 Aug 2024 03:40:37 +0200 Subject: [PATCH] Allow skipping the `User` parameter --- scripts/Windows/Scripts/PowerManagement.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Windows/Scripts/PowerManagement.ps1 b/scripts/Windows/Scripts/PowerManagement.ps1 index 69f834cc..bcaabad2 100644 --- a/scripts/Windows/Scripts/PowerManagement.ps1 +++ b/scripts/Windows/Scripts/PowerManagement.ps1 @@ -75,13 +75,14 @@ $null = New-Module { param( [Parameter(ParameterSetName="System")] [switch] $System, - [Parameter(ParameterSetName="User",Mandatory)] + [Parameter(ParameterSetName="User", Mandatory)] [switch] $User, [Parameter(ParameterSetName="User")] + [Parameter(ParameterSetName="SpecificUser", Mandatory)] [RegistryKey] $UserKey ) - if ($User.IsPresent) { + if ($User.IsPresent -or $UserKey) { if (-not $UserKey) { $UserKey = Get-Item "HKCU:\"; }