Created
July 28, 2022 13:46
-
-
Save JohnL4/a3f8c13575d4ebd7e2a482614bc85b4f to your computer and use it in GitHub Desktop.
Convert a Windows SID to a user name
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
| # 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