How To Find Out The User's Sid

Table of contents:

How To Find Out The User's Sid
How To Find Out The User's Sid

Video: How To Find Out The User's Sid

Video: How To Find Out The User's Sid
Video: How to Find Your Users Security Identifier(SID) on Windows 10? 2024, April
Anonim

Users are identified in Windows OS not by names, but by special security identifiers, or Security Identifier - SID. The solution to the problem of determining the SID of the selected user does not require the use of additional software and is carried out using standard system tools.

How to find out the user's sid
How to find out the user's sid

Instructions

Step 1

Call the main system menu by clicking the "Start" button and go to the "Run" dialog. Type regedit in the "Open" line and confirm the launch of the Registry Editor utility by clicking the OK button. Expand the branch

HKEY_LOCAL_MACHINE / Software / Microsoft / WindowsNT / CurrentVersion / ProfileList

and find all User IDs (SIDs). Go to the ProfikeImagePath key and find the corresponding SID username value. Exit the Registry Editor utility.

Step 2

The reverse operation, when the SID of the user is known and it is required to determine the name of his account, can be performed using the reg.exe command. In this case, the command syntax looks like:

reg query HKEY_LOCAL_MACHINE / Software / Microsoft / WindowsNT / CurrentVersion / ProfileList / ProfileImagePath.

Step 3

Use the built-in GetSID utility to determine the unique identifier for the selected user. The command syntax looks like:

drive_name: > getsid

Usage: getsid / server1 account / server2 account.

Step 4

An alternative method to programmatically obtain the SID of the desired user is to use the SecurityIdentifier class in the. NET Framework 2.0. In this case, the identifier can be displayed as a string, a byte array, or a combination of the WellKnownSidType and domain SID values. An additional condition for obtaining the desired result is a call to the WindowsIdentity class. The syntax for such a command looks like this:

using System;

using System. Security. Principal;

namespace GetSID

{

class Program

{

static void Main (string args)

{

WindowsIdentity wid = Windowsidentity. GetCurrent ();

Console. WriteLine (wid. Name + SID is 0, wid. User. Value);

Console. Read ();

}
}
}.

Recommended: