How to: Convert a SID to username in PowerShell
I’m starting a new series of blog posts which are short, bitesize chunks of helpful items I’ve found or learnt over time.
To start off, we’re going to convert a SID to a username using PowerShell.
PS C:\WINDOWS\system32> $SID = New-Object System.Security.Principal.SecurityIdentifier(“S-1-5-21-1180699209-877415012-3182924384-1004”)
PS C:\WINDOWS\system32> $User = $SID.Translate([System.Security.Principal.NTAccount])
PS C:\WINDOWS\system32> $User.Value
Once done, you’ll have the username!