MyKE / Determine SID object in Active Directory

Created Mon, 15 Aug 2016 08:44:53 +0000
50 Words

Determine SID object in Active Directory

Short article how to determine SID of known AD User and vice versa.

Determine SID of known AD User:

$objUser = New-Object System.Security.Principal.NTAccount("MyDomain", "MyADUser")
$strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
$strSID.Value

Determine which SID belongs to:

$objSID = New-Object System.Security.Principal.SecurityIdentifier ("S-1-5-21-XYZ")
$objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
$objUser.Value

You can find more here on technet.