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";



 While you're here -
Why not check out our 
Active Directory Documentation Tool?

Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Enable function lock for F1-F12 on HP ZBook mobile workstations