I found a link on this website which shows how to convert a SID to the binary type. Can someone please tell me how to do the reverse - to convert a binary type back to a SID.
This is the script that was provided to go from SID to binary:
PS> $sid = New-Object System.Security.Principal.SecurityIdentifier ("S-1-5-21-105005785-2143699225-541720777-501")
PS> $c = New-Object 'byte[]' $sid.BinaryLength
PS> $sid.GetBinaryForm($c, 0)
Thanks!
To go from byte array to SID, try:
(New-Object System.Security.Principal.SecurityIdentifier($c, 0)).toString()