Skip to content

Instantly share code, notes, and snippets.

@mykappa
Created February 10, 2023 13:25
Show Gist options
  • Save mykappa/b02b0106937f503f94cf21940d831db7 to your computer and use it in GitHub Desktop.
Save mykappa/b02b0106937f503f94cf21940d831db7 to your computer and use it in GitHub Desktop.
Get current user Security Identifier (SID) with Windows PowerShell
$User = New-Object System.Security.Principal.NTAccount($env:UserDomain, $env:UserName)
$SID = $User.Translate([System.Security.Principal.SecurityIdentifier])
$SID.Value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment