Get User SID
To get the SID (Security Identifier) you can use the command wmic useraccount
. The command wmic useraccount
is a command-line tool that allows you to get information about user accounts on a Windows system. By adding the where name='username'
clause, you are specifying that you only want information about the user account with the specific username that you enter.
Finally, the get sid
command is used to retrieve the SID of the user account specified in the previous clause.
So, in summary, the command wmic useraccount where name='username' get sid
is used to get the SID of a specific user account, by specifying the username of the account in place of 'username'. And if you want to get the SID of the currently logged in user, you can use the command whoami /user
.
wmic useraccount
The username
are without domain.
wmic useraccount where name='username' get sid
whoami /user
whoami /user
The result will look like this