Last active
September 5, 2023 06:27
-
-
Save yon2004/997509f3074aed0f282d8161bf4efc58 to your computer and use it in GitHub Desktop.
Convert AD BASE64 SID to SDDL format and back.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Convert from Base64 to SID | |
[byte[]]$sid = [System.Convert]::FromBase64String("AQUAAAAAAAUVAAAAuwkCIyAUg1vk+E/VWQQAAA==") | |
$si = New-Object Security.Principal.SecurityIdentifier($sid,0) | |
$si.ToString() | |
#Convert from SID to Base64 (Needed for squid) | |
$sidconvert = New-Object Security.Principal.SecurityIdentifier("S-1-5-21-587336123-1535317024-3578788068-1112") | |
$sid_out = New-Object 'byte[]' $sidconvert.BinaryLength | |
$sidconvert.GetBinaryForm($sid_out,0) | |
[System.Convert]::ToBase64String($sid_out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment