Get the SID of an Active Directory User

Can’t remember why I needed to, but if you need to get the SID of an Active Directory user account you can run either of these powershell scripts:

$name = “username”
 (New-Object System.Security.Principal.NTAccount($name)).Translate([System.Security.Principal.SecurityIdentifier]).value


$objUser = New-Object System.Security.Principal.NTAccount("fabrikam", "kenmyer")
 $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
Tags: SID
Disqus Comments Loading...
All Rights ReservedRegular Version