Skip to content

Instantly share code, notes, and snippets.

@alex4rks
Created September 2, 2020 16:53
Show Gist options
  • Select an option

  • Save alex4rks/4372115ed520119076ebb3ccb7eac0b5 to your computer and use it in GitHub Desktop.

Select an option

Save alex4rks/4372115ed520119076ebb3ccb7eac0b5 to your computer and use it in GitHub Desktop.
function Get-UsernameSID($AccountName) {
$NTUserObject = New-Object System.Security.Principal.NTAccount($AccountName)
$NTUserSID = $NTUserObject.Translate([System.Security.Principal.SecurityIdentifier])
return $NTUserSID.Value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment