The whoami is used to display the domain and user name of the person who is currently logged on to this computer.
If used without parameters, whoami displays the current domain and user name.
You can use this command with the next parameters:

/upnDisplays the user name in the user principal name (UPN) format.
/fqdnDisplays the user name in the fully qualified domain name (FQDN) format.
/logonidDisplays the logon ID of the current user.
/userDisplays the current domain and user name and the security identifier (SID).
/groupsDisplays the user groups to which the current user belongs.
/privDisplays the security privileges of the current user.
/fo <Format>Specifies the output format. Valid values include:

table   Displays output in a table. This is the default value.

list   Displays output in a list.

csv   Displays output in comma-separated value (CSV) format.

/allDisplays all information in the current access token, including the current user name, security identifiers (SID), privileges, and groups that the current user belongs to.
/nhSpecifies that the column header should not be displayed in the output. This is valid only for table and CSV formats.
/?Displays help at the command prompt.

Some examples with this command:

  • check if we are running elevated: whoami /groups | find “-” ;
  • display all of the information in the current access token: whoami /all ;
  • see what security groups you belong to whoami /groups ;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.