Windows 10: Find Security Identifier (SID) of User in Windows  

    Find Security Identifier (SID) of User in Windows

    Find Security Identifier (SID) of User in Windows

    How to Find Security Identifier (SID) of User in Windows
    Published by Category: User Accounts
    08 Mar 2018
    Designer Media Ltd

    Published by


    Brink's Avatar
    Administrator

    Posts: 28,469

    Show Printable Version 


    How to Find Security Identifier (SID) of User in Windows


    Sometimes, you need to know what the security identifier (SID) is for a specific user on the system.

    A SID is a string value of variable length that is used to uniquely identify users or groups, and control their access to various resources like files, registry keys, network shares etc. Each account has a unique SID that an authority, such as a Windows domain, issues. The SID is stored in the security database. When a user logs on, the system retrieves the user SID from the database, places the SID in the user access token, and then uses the SID in the user access token to identify the user in all subsequent interactions with Windows security. Each SID is a unique identifier for a user or group, and a different user or group cannot have the same SID.

    See also: Well-known security identifiers in Windows operating systems

    This tutorial will show you different ways on how to find the security identifier (SID) of a user account in Vista, Windows 7, Windows 8, and Windows 10.


     CONTENTS:

    • Option One: To Find SID of Current User using "WhoAmI" command
    • Option Two: To Find SID of Current User using "wmic useraccount" command
    • Option Three: To Find SID of All Users using "wmic useraccount" command
    • Option Four: To Find SID of Specific User using "wmic useraccount" command
    • Option Five: To Find User Name for SID using "wmic useraccount" command
    • Option Six: To Find SID of All Users using "Get-WmiObject" PowerShell command
    • Option Seven: To Find SID of Users using Registry Editor


    EXAMPLE: Security Identifier (SID) with account association
    Name:  SID.gif
Views: 3717
Size:  4.5 KB






    Find Security Identifier (SID) of User in Windows OPTION ONE Find Security Identifier (SID) of User in Windows
    To Find SID of Current User using "WhoAmI" command

    1. Open a command prompt or PowerShell.

    2. Enter the command below, and press Enter.

    whoami /user

    Name:  whoami_user.png
Views: 3873
Size:  10.7 KB





    Find Security Identifier (SID) of User in Windows OPTION TWO Find Security Identifier (SID) of User in Windows
    To Find SID of Current User using "wmic useraccount" command

    1. Open a command prompt.

    2. Enter the command below, and press Enter.

    wmic useraccount where name='%username%' get domain,name,sid

    Name:  wmic_useraccount-2.png
Views: 3692
Size:  11.0 KB





    Find Security Identifier (SID) of User in Windows OPTION THREE Find Security Identifier (SID) of User in Windows
    To Find SID of All Users using "wmic useraccount" command

    1. Open a command prompt or PowerShell.

    2. Enter the command below, and press Enter.

    wmic useraccount get domain,name,sid

    Name:  wmic_useraccount-1.png
Views: 3808
Size:  20.1 KB





    Find Security Identifier (SID) of User in Windows OPTION FOUR Find Security Identifier (SID) of User in Windows
    To Find SID of Specific User using "wmic useraccount" command

    1. Open a command prompt or PowerShell.

    2. Enter the command below, and press Enter.

    wmic useraccount where name='username' get sid

    Substitute username in the command above with the actual user name (ex: "Brink") of the account you want to find the SID for.

    For example: wmic useraccount where name='Brink' get sid

    Name:  wmic_useraccount-3.png
Views: 3660
Size:  9.3 KB





    Find Security Identifier (SID) of User in Windows OPTION FIVE Find Security Identifier (SID) of User in Windows
    To Find User Name for SID using "wmic useraccount" command

    1. Open a command prompt or PowerShell.

    2. Enter the command below, and press Enter.

    wmic useraccount where sid='<sid>' get domain,name

    Substitute <sid> in the command above with the actual SID (ex: "S-1-5-21-237214570-1361766723-3061440971-1001") of the account you want to see the name for.

    For example: wmic useraccount where sid='S-1-5-21-237214570-1361766723-3061440971-1001' get domain,name

    Name:  wmic_useraccount-4.jpg
Views: 3652
Size:  26.9 KB





    Find Security Identifier (SID) of User in Windows OPTION SIX Find Security Identifier (SID) of User in Windows
    To Find SID of All Users using "Get-WmiObject" PowerShell command

    1. Open PowerShell.

    2. Enter the command below, and press Enter.

    Get-WmiObject win32_useraccount | Select domain,name,sid

    Name:  Get-WmiObject_PowerShell.png
Views: 3776
Size:  19.9 KB





    Find Security Identifier (SID) of User in Windows OPTION SEVEN Find Security Identifier (SID) of User in Windows
    To Find SID of Users using Registry Editor


    This option has one limitation which is you can only get the SID of either a local user or a domain user who has logged in at least once onto this PC.

    1. Press the Win+R keys to open Run, type regedit, and click/tap on OK to open Registry Editor.

    2. Navigate to the key below in the left pane of Registry Editor. (see screenshot below)

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

    3. Each of the items at this hive is named with the SID of the account. By looking at the ProfileImagePath key for each SID, you can identify the account’s name.

    For example, the S-1-5-21-237214570-1361766723-3061440971-1001 SID key is for the user with the C:\Users\Brink profile folder path and Brink being the account name.

    Name:  ProfileList_registry.jpg
Views: 3712
Size:  75.0 KB


    That's it,
    Shawn



  1. Posts : 93
    Windows 10
       20 May 2017 #1

    Some useful SID related functions for script use. Also demonstrates how to retrieve SID information from .NET instead of WMI.
    Code:
    function Get-SidFromName ($user) {
        (New-Object System.Security.Principal.NTAccount($user)).Translate([System.Security.Principal.SecurityIdentifier]).Value
    }
    
    function Get-NameFromSid ($sid) {
        (New-Object System.Security.Principal.SecurityIdentifier($sid)).Translate([System.Security.Principal.NTAccount]).Value
    }
    
    function Get-CurrentUserSid {
        [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
    }
    
    function Get-UserSidFromWildcard ($sid) {
        ([ADSI]"WinNT://$env:COMPUTERNAME").Children | ?{$_.SchemaClassName -eq 'User'} | %{(New-Object Security.Principal.SecurityIdentifier($_.objectSid.Value, 0)).Value} | ?{$_ -like $sid}
    }
    
    function Get-GroupSidFromWildcard ($sid) {
        ([ADSI]"WinNT://$env:COMPUTERNAME").Children | ?{$_.SchemaClassName -eq 'Group'} | %{(New-Object Security.Principal.SecurityIdentifier($_.objectSid.Value, 0)).Value} | ?{$_ -like $sid}
    }
    
    function Get-ServiceSidFromWildcard ($sid) {
        ([ADSI]"WinNT://$env:COMPUTERNAME").Children | ?{$_.SchemaClassName -eq 'Service'} | %{(New-Object Security.Principal.SecurityIdentifier($_.objectSid.Value, 0)).Value} | ?{$_ -like $sid}
    }
    
    function Get-SidFromWildcard ($sid) {
        ([ADSI]"WinNT://$env:COMPUTERNAME").Children | ?{'Group', 'User' -contains $_.SchemaClassName} | %{(New-Object Security.Principal.SecurityIdentifier($_.objectSid.Value, 0)).Value} | ?{$_ -like $sid}
    }
      My ComputerSystem Spec


  2. Posts : 2,320
    Windows 10 Pro x64 FCU - XP/Vista/Win7/Win8.1 in VM for testing
       20 May 2017 #2

    Shawn, There's also Mark Russinovich's tool PsGetSid
      My ComputerSystem Spec


  3. Posts : 28,469
    64-bit Windows 10 Pro build 17643
    Thread Starter
       20 May 2017 #3

      My ComputersSystem Spec


  4. Posts : 161
    Windows 10 Enterprise x64 1709
       17 Dec 2017 #4

    WMIC UserAccount Where Name='%Username%' Get SID
    -
    This works perfectly but it only works in Command Prompt and not in a .bat file.
    I also cannot assign it to a string variable since it's not just SID and is a multi line string.
    I'm not very comfortable with batch files so what's the shortest and easiest way to store it in a variable to use in a batch file?
      My ComputerSystem Spec


  5. Posts : 28,469
    64-bit Windows 10 Pro build 17643
    Thread Starter
       17 Dec 2017 #5

    Hello omidsolo,

    If you like, you could use the command in Option 1 or 3 in a .bat file.
      My ComputersSystem Spec


 

Tutorial Categories

Find Security Identifier (SID) of User in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Xbox Windows Phone


Related Threads
How to Find and Read Microsoft End User License Agreement (EULA) in Windows 10 In proprietary software, an end-user license agreement (EULA) or software license agreement is the contract between the licensor and purchaser, establishing the...
MS can't can't find my user name in User Accounts and Family Safety
I just installed Office 2016 professional and it's working fine. My problem is when they ask for my user ID and password. I ran the Microsoft Support and Recovery Tool just to see if I have any problems. I was asked to put in my User ID and...
Deleting zone.identifier files in General Support
Recently did a backup of a bunch of files off of a failing HD using a recovery programs. That worked, but most of the image folders I have, all of the image files have their own Zone.identifier file attatched. If I try to delete it says this file is...
Is a standard user account really necessary for tight security for the home user or will a well secured administrator account be sufficient?
Cannot access or find user account in User Accounts and Family Safety
I'm currently on the latest Insider Preview version of Windows 10 Pro. I've experienced a weird issue for at least past 2-3 Preview versions. Firstly, when I try to log in with pin code, I get something like 'object info not found'. When I try go...

Tags for this Thread

Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:56.
Find Us