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
    15 May 2017
    Designer Media Ltd

    Published by


    Brink's Avatar
    Administrator

    Posts: 25,172

    Show Printable Version 


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

    information   Information
    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.

    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: 1862
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: 1902
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: 1864
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: 1925
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

    Note   Note
    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: 1856
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

    Note   Note
    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: 1845
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: 1892
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

    Note   Note
    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.
    Note   Note
    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: 1869
Size:  75.0 KB


    That's it,
    Shawn


  1.    20 May 2017 #1
    Join Date : Mar 2015
    Sydney, NSW
    Posts : 93
    Windows 10

    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.    20 May 2017 #2
    Join Date : Oct 2013
    Newport, South Wales, UK
    Posts : 1,801
    Windows 10 Pro x64 FCU - XP/Vista/Win7/Win8.1 in VM for testing

    Shawn, There's also Mark Russinovich's tool PsGetSid
      My ComputerSystem Spec
  3.    20 May 2017 #3
    Join Date : Oct 2013
    Posts : 25,172
    64-bit Windows 10 Pro build 17040
    Thread Starter

      My ComputersSystem Spec

 


Similar Threads
Tutorial Category
General Tips Find Microsoft End User License Agreement (EULA) in Windows 10
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...
Tutorials
MS can't can't find my user name
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...
User Accounts and Family Safety
Deleting zone.identifier files
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...
General Support
Is a standard user account necessary for tight security and home user?
Is a standard user account really necessary for tight security for the home user or will a well secured administrator account be sufficient?
AntiVirus, Firewalls and System Security
Cannot access or find user account
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...
User Accounts and Family Safety
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 18:14.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums