Skip to content

Commit 0cdc1ad

Browse files
authored
Couterproposal
- Restore deleted prose from documentation/help - Avoid directly dereferencing `[System.Security.Principal.WindowsIdentity]::GetCurrent()`
1 parent 6419b12 commit 0cdc1ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Code snippets/Functions library.psm1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ function Test-UserAdminMembership {
1818
.SYNOPSIS
1919
Returns $True when the user account running this script is a member of the local Administrators group.
2020
.DESCRIPTION
21-
This function checks whether the current user account is a member of the local Administrators group.
21+
This function checks whether the current user account is a member of the local Administrators group. If the answer is positive, depending on the User Account Control configuration on this machine, this script may either be running with administrative privileges or may request it.
2222
#>
23-
return [Security.Principal.WindowsIdentity]::GetCurrent().Claims.Value.Contains('S-1-5-32-544')
23+
$MyId = [System.Security.Principal.WindowsIdentity]::GetCurrent()
24+
return $MyId.Claims.Value.Contains('S-1-5-32-544')
2425
}
2526

2627
function Unregister-ScheduledTaskEx {

0 commit comments

Comments
 (0)