Using PowerShell to Resolve SIDs to Friendly Names

Time and time again I run into an issue that presents me with a SID which I need to resolve.  I’ve used a number of tools and scripts over the years to address this issue.  I think I have the best and easiest method for me to solve this issue that always seems to pop up.

If you’re new to PowerShell you will want to make sure you have it installed if you want to use this script…and yes it is a script not a command.  I do this by opening a text file and renaming it from a .txt file to a .ps1 file.  When you try to open a .ps1 file it may open in your text editor but for this you will want to Right Click it and select Edit which will open up whatever you have as your PowerShell editor.  Copy the following code into the Script Pane:

$objSID = New-Object System.Security.Principal.SecurityIdentifier
$objUser = $objSID.Translate( [System.Security.Principal.NTAccount])

Now just save this file and you can run it to return the results of the SID that you place in there.  The one thing that will change is the actual SID.  In this example i’m using S-1-5-21-768745588-123456789-987654321-500 which is the Well Known SID for the domain Administrator.  My results should show me the friendly name.  Anytime you change the SID you will have to resave the file but then just Run the script and it will show you the results.

I’m sure there is a way I could make this into an application but I”ll leave that fun for those looking to take this to the next step.


  1. Spad says:

    Obviously there are scenarios where the Powershell option is better, but a good Admin should never leave home with a copy of PSTools :)

  2. BrianM says:

    I love psgetsid but does it resolve SIDs to names?

  3. dubbelringar says:

    Hi there, I want to subscribe for this web site
    to take latest updates, thus where can i do it please help out.

  4. Greg says:

    This script needs a ` at the end of the first line in order to work, i.e.

    $objSID = New-Object System.Security.Principal.SecurityIdentifier `

Leave a comment