Convert an Active Directory SID to a name

To convert an Active Directory SID to a name use:

$SID ='S-1-5-21-1210182304-1361979235-1847136127-5299'
$objSID = New-Object System.Security.Principal.SecurityIdentifier($SID)
$objUser = $objSID.Translate([System.Security.Principal.NTAccount])
Write-Host "Resolved user name: " $objUser.Value 

 

Remember that you cannot translate the SID if the object has been deleted.

Leave a Reply

Your email address will not be published. Required fields are marked *