Display user, group and privileges for the current user.
Syntax
whoami [/upn | /fqdn | /logonid]
whoami {[/user] [/groups] [/priv]} [/fo Format] [/nh]
whoami /all [/fo Format] [/nh]
Key
/upn Display the user name in user principal name (UPN) format.
/fqdn Display the user name in fully qualified domain name (FQDN) format.
/logonid Display the logon ID of the current user.
/user Display the current domain and user name and the security identifier (SID).
/groups Display the user groups to which the current user belongs.
Includes the Integrity Control level:
Mandatory Label\Low Mandatory Level = Low.
Mandatory Label\Medium Mandatory Level = Medium/Standard.
Mandatory Label\High Mandatory Level = Elevated.
/priv Display the security privileges of the current user.
/fo The output format. Valid values:
table Table format (default)
list List format.
csv Comma-separated value (CSV) format.
/all Display 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 Don't display the column header in the output.
This is valid only for table and CSV formats.
/? Help
Examples
Display the domain and user name of the current user:
whoami
Display the user groups to which the current user belongs:
whoami /groups
Display all of the information in the current access token:
whoami /all
“We can now manipulate images to such an extrodinary extent that there's no lie you cannot tell” ~ Sir David Attenborough
Related:
icacls /setintegritylevel - Add an integrity control ACE.
SET - Display, set, or remove Windows environment variables.
VER - Display version information.
VOL - Display a disk label.
Whereami.cmd - Display user information.
Environment variables: %USERDOMAIN% and %USERNAME%
Powershell: PS> whoami /groups /fo csv | convertfrom-csv
Equivalent bash command (Linux): whoami - Print the current user id and name (`id -un').