NT Account to SID translation …. and back again.


I keep the following nifty functions in my Powershell profile, it helps when working with SIDs and Active Directory, it allows you to easily convert a SID back to the NTACCOUNT and vice versa…


function ConvertTo-Sid ($NtAccount) {(new-object system.security.principal.NtAccount($NTaccount)).translate([system.security.principal.securityidentifier])}

function ConvertTo-NtAccount ($sid) {(new-object system.security.principal.securityidentifier($sid)).translate([system.security.principal.ntaccount])}

Leave a Reply