How to find SIDs of local user accounts
If you are not familiar with Security Identifiers (SIDs), please visit the next link to understand what are Security Principals and Security Identifiers (SIDs).
All the examples shown in this lesson to find the SIDs of local user accounts were run on PowerShell terminal. Please click the following link to learn how to open PowerShell terminal in a Windows Server, if you are new to PowerShell.
In Windows Operating Systems, a SID (Security Identifier) is used to identify a Security Principal. A Security Principal is someone who can be authenticated by the Operating System. Security Principal can be a local user, domain user, local computer, domain computer etc. SIDs are binary values stored in a local Windows Server or in Active Directory Domain Controllers. For the purpose of humans to comprehend and handle with ease, Windows Operating Systems display the binary SID values as long strings.
Find SIDs of all local user accounts using Get-LocalUser PowerShell cmdlet
Get-LocalUser PowerShell cmdlet can be used to find the SIDs of all local users in a Windows Server. Run Get-LocalUser PowerShell cmdlet as shown below to find SIDs of all local user accounts in a Windows Server.
PS C:\jajish> Get-LocalUser | Select name,sid Name SID ---- --- Administrator S-1-5-21-3145586660-3425903922-524180734-500 DefaultAccount S-1-5-21-3145586660-3425903922-524180734-503 Guest S-1-5-21-3145586660-3425903922-524180734-501 jajish S-1-5-21-3145586660-3425903922-524180734-1006 WDAGUtilityAccount S-1-5-21-3145586660-3425903922-524180734-504
Please refer below image to find how to use Get-LocalUser PowerShell cmdlet to find the SIDs of all local user accounts.
Find the SID of current logged–in user using Get-LocalUser PowerShell cmdlet
You may use Get-LocalUser PowerShell cmdlet to find the SID of current logged–in user in a Windows Server. Use Get-LocalUser PowerShell cmdlet as shown below to find the SID of current logged–in user in a Windows Server. Please replace the login name "jajish" in below Get-LocalUser PowerShell cmdlet with your logged-in user name.
PS C:\jajish> Get-LocalUser jajish | Select name,sid Name SID ---- --- jajish S-1-5-21-3145586660-3425903922-524180734-1006
Please refer below image to learn how to find the SID of current logged–in user in a Windows Server, using Get-LocalUser PowerShell cmdlet.
Find SIDs of all local user accounts using Get-WmiObject PowerShell cmdlet
Get-WmiObject PowerShell cmdlet can be used to find the SIDs of all local user accounts in a Windows Server. Use Get-WmiObject PowerShell cmdlet as shown below to find SIDs of all local user accounts in a Windows Server.
PS C:\jajish> Get-WmiObject Win32_UserAccount | Select name,sid name sid ---- --- Administrator S-1-5-21-3145586660-3425903922-524180734-500 DefaultAccount S-1-5-21-3145586660-3425903922-524180734-503 Guest S-1-5-21-3145586660-3425903922-524180734-501 jajish S-1-5-21-3145586660-3425903922-524180734-1006 WDAGUtilityAccount S-1-5-21-3145586660-3425903922-524180734-504 PS C:\jajish>
Please refer below image to find how to use Get-WmiObject PowerShell cmdlet to find the SIDs of all local user accounts.
Find SID of current logged–in user using Get-WmiObject PowerShell cmdlet
You may use PowerShell cmdlet Get-WmiObject to find the SID of current logged–in user in a Windows Server. Use Get-WmiObject PowerShell cmdlet as shown below to find the SID of current logged–in user in a Windows Server. Please replace the login name "jajish" in the below Get-WmiObject PowerShell cmdlet output with your logged-in user name.
PS C:\jajish> Get-WmiObject Win32_UserAccount -Filter "name='jajish'" AccountType : 512 Caption : OMNISECU-7\jajish Domain : OMNISECU-7 SID : S-1-5-21-3145586660-3425903922-524180734-1006 FullName : Jajish Thomas Name : jajish
Please refer below image to learn how to find the SID of current logged–in user in a Windows Server, using Get-WmiObject PowerShell cmdlet.
Find SID of current user using whoami.exe tool
You may use the whoami.exe tool to find the SID of the current logged-in user, as shown below
PS C:\jajish> whoami /user USER INFORMATION ---------------- User Name SID ======================== ============================================ omnisecu-7\administrator S-1-5-21-3145586660-3425903922-524180734-500 PS C:\jajish>
Please refer below image to learn how to use whoami.exe tool to find the SIDs of current logged–in user.
Written by Jajish Thomas.
Last updated on 21st August, 2024.