Created
March 19, 2016 18:37
-
-
Save itpropro/5625c5171329904460b1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function Get-SidfromHex { | |
param | |
( | |
[string]$Sid | |
) | |
$ByteSid = New-Object Byte[] 150 | |
for ($i = 0; $i -lt $Sid.Length ; $i += 2) { | |
$ByteSid.Set(($i/2),([Byte]::Parse($Sid.Substring($i, 2), [System.Globalization.NumberStyles]::HexNumber))) | |
} | |
New-Object System.Security.Principal.SecurityIdentifier($ByteSid,0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment