Skip to content

Windows WHOAMI command

The Windows whoami command is used to display the username and group information for the current user. It can also show the privileges of the user, such as being a member of the administrators group. This command is useful for troubleshooting and verifying the user account details within a Windows environment. You can run the whoami command in the command prompt to quickly access this information.

Terminal window
whoami [/USER] [/GROUPS] [/PRIV]
OptionDescription
/USERDisplays the current username.
/GROUPSDisplays the groups a user is a member of.
/PRIVDisplays the privileges of the current user.

There are no parameters for the whoami command.

Terminal window
whoami

Displays the username and group information for the current user.

Terminal window
whoami /priv

Displays the current user’s security privileges, such as enabled and disabled privileges.

Terminal window
whoami /all

Displays detailed information about the current user, including user name, group memberships, and security identifiers.

Check User and Group Information in JSON format

Section titled “Check User and Group Information in JSON format”
Terminal window
whoami /fo json

Displays user and group information in JSON format, suitable for parsing and scripting purposes.

To use the whoami command in Windows, execute the following command:

Terminal window
whoami

What is the purpose of the /UPN parameter in whoami?

Section titled “What is the purpose of the /UPN parameter in whoami?”

The /UPN parameter in whoami displays the current User Principal Name (UPN) in the output. Here is an example of using it:

Terminal window
whoami /UPN

How can I display the current privileges with whoami?

Section titled “How can I display the current privileges with whoami?”

You can display the current privileges using the /PRIV parameter in whoami. Simply execute the command shown below:

Terminal window
whoami /PRIV

How do I check group memberships with whoami?

Section titled “How do I check group memberships with whoami?”

To check group memberships in Windows using whoami, use the /GROUPS parameter. Here is the command example:

Terminal window
whoami /GROUPS

Can I get the SID (Security Identifier) using whoami?

Section titled “Can I get the SID (Security Identifier) using whoami?”

Yes, you can retrieve the SID (Security Identifier) for the current user by using the /SID parameter with whoami. Run the following command:

Terminal window
whoami /SID

How do I display the logon ID with whoami?

Section titled “How do I display the logon ID with whoami?”

To display the logon ID, you can use the /LOGONID parameter with the whoami command. Here is how to do it:

Terminal window
whoami /LOGONID

What is the /USER parameter used for in the whoami command?

Section titled “What is the /USER parameter used for in the whoami command?”

The /USER parameter in whoami displays the current username. To see the username, execute the following command:

Terminal window
whoami /USER
  • Verifying the current user’s identity
  • Checking group membership
  • Scripting and automation tasks
  • Troubleshooting and diagnosing user permission issues