Convert security identifier (SID) to account name using Active Directory PowerShell Get-ADObject cmdlet
If you have a security identifier that you want to use resolve into an account name you can always use PowerShell remoting and the SecurityIdentifier class however if you want to use directly using Active Directory and the Active Directory PowerShell cmdlets you can use the following.
$sddl = "S-1-5-21-1531147241-2246046137-799074561-512";
$account = Get-ADObject -Filter "objectSid -eq '$sddl'" -Properties "msDS-PrincipalName";
$account."msDS-PrincipalName";
Comments
Post a Comment