Skip to content

Instantly share code, notes, and snippets.

@itpropro
Created March 19, 2016 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itpropro/8ccd66b2e41319511d51 to your computer and use it in GitHub Desktop.
Save itpropro/8ccd66b2e41319511d51 to your computer and use it in GitHub Desktop.
function Get-NtSecurityDescriptor {
param
(
[string]$SecurityDescriptor
)
$ntsecdesc = New-Object Byte[] ($SecurityDescriptor.Length)
for ($i = 0; $i -lt $SecurityDescriptor.Length ; $i += 2) {
$ntsecdesc.Set(($i/2),([Byte]::Parse($SecurityDescriptor.Substring($i, 2), [System.Globalization.NumberStyles]::HexNumber)))
}
[System.Security.AccessControl.RawSecurityDescriptor]::new($ntsecdesc,0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment