PsGetSid (SysInternals)

Display the SID of a computer or a user.

      psgetsid [\\computer[,computer[,...] | @get_file] [-u user [-p passwd]]] [account|SID]


   computer   The remote computer on which to list files. Default = local system 

   @get_file  Get the SID of every computer listed in the text file specified.
   -p passwd  Specify a password for user (optional). Passed as clear text.
              If omitted, you will be prompted to enter a hidden password.

   -u user    Specify a username for login to remote computer(optional).

   account    The user account to resolve to a user SID

   SID        A User account System Identifier 

   -accepteula Suppress the display of the license dialog.

Specify a user name if the account you are running from doesn’t have administrative privileges on the computer you want to query.

To retrieve a computer SID pass the computer's name.
To retrieve a user account SID, pass the account name (e.g. "-u administrator") on the command-line, and optionally the computer name.

Obtaining the Users SID makes it possible to update specific user registry hives under HKey_Users

When launched for the first time, PsGetSid will prompt you to accept the EULA.
You can avoid this by writing the license registry key:

Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Sysinternals' -Name 'EulaAccepted' -Value 1


Get the SID of \\workstation64:

psgetsid \\workstation64

Get the computer SID for the computer at IP address

psgetsid \\

Get the domain SID for the domain ss64Dom:

psgetsid ss64Dom

Get the SID for the user CaraJ from workstation64:

psgetsid \\workstation64 -u CaraJ

Get the SID for the currently logged-in user and place in a variable:

@Echo Off
For /f "tokens=1 skip=1" %%G in ('psgetsid %username% -accepteula 2^>nul') do set _SID=%%G

“From the first time I saw Sid Caesar be funny I knew that's what I had to do” ~ Billy Crystal

Related commands

SYSTEMINFO - List system configuration.
Q243330 - Well-known security identifiers (sids) in Windows operating systems.

Copyright © 1999-2023
Some rights reserved