Many examples on the web show the way to check current user for Administrative privileges using
[Security.Principal.WindowsPrincipal]
[Security.Principal.WindowsIdentity]::GetCurrent()
Is there a similar way to check not the 'current' identity, but any (local or domain, for example, retrieved from Get-ACL
cmdlet) when running commands on a particular server.
I checked https://learn.microsoft.com/en-us/dotnet/api/system.security.principal.windowsidentity.-ctor?view=netframework-4.7.2#System_Security_Principal_WindowsIdentity__ctor_System_String_, but couldn't find a way to do it (only if you use constructor with UPN parameter, which is not suitable in my case). I would appreciate any hint.