Skip to content

Instantly share code, notes, and snippets.

@JohnL4
Created July 28, 2022 13:46
Show Gist options
  • Save JohnL4/a3f8c13575d4ebd7e2a482614bc85b4f to your computer and use it in GitHub Desktop.
Save JohnL4/a3f8c13575d4ebd7e2a482614bc85b4f to your computer and use it in GitHub Desktop.
Convert a Windows SID to a user name
# From https://morgantechspace.com/2015/09/convert-sid-to-username-using-powershell.html#:~:text=SecurityIdentifier%20in%20Windows%20PowerShell%20script,to%20security%20identifier%20(SID).
$SID ='S-1-5-21-1924530255-1943933946-939161726-500'
$objSID = New-Object System.Security.Principal.SecurityIdentifier($SID)
$objUser = $objSID.Translate([System.Security.Principal.NTAccount])
Write-Host "Resolved user name: " $objUser.Value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment