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:
|/upn||Displays the user name in the user principal name (UPN) format.|
|/fqdn||Displays the user name in the fully qualified domain name (FQDN) format.|
|/logonid||Displays the logon ID of the current user.|
|/user||Displays the current domain and user name and the security identifier (SID).|
|/groups||Displays the user groups to which the current user belongs.|
|/priv||Displays 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.
|/all||Displays all information in the current access token, including the current user name, security identifiers (SID), privileges, and groups that the current user belongs to.|
|/nh||Specifies 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 ;