How to get the SID of a Security Principal with Powershell

This Powershell code snippet easily displays the SID of a Windows Security Principal:

1
2
3
$principal = New-Object System.Security.Principal.NTAccount("builtin\Administrators")
$principalSID = $principal.Translate([System.Security.Principal.SecurityIdentifier]).Value 
$principalSID

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.