Not many of you may know it, but Windows has a command-line utility called the WHOAMI utility (Who Am I). With this utility, you can find the name of the account currently logged on, its SID, the names of the security groups of which it’s a member and its privileges. The tool is available on Windows 11/10 and is also available as part of the Windows Resource Kit.
WHOAMI in Windows 11/10
The whoami utility can be used to get the user name and group information along with the respective security identifiers (SID), privileges, logon identifier (logon ID) for the current user (access token) on the local system. i.e. who is the currently logged-on user? If no switch is specified, the tool displays the user name in NTLM format (domain\username).
To use whoami, run cmd.exe first.
To learn the name of the logged-on user, simply type whoami and hit Enter. This is particularly useful if you’re logged on as a standard user, but running an elevated Command Prompt window.
For a complete list of Whoami parameters, and for learning about the syntax, type whoami /?
Here is the complete parameter list for WOAMI
WHOAMI Parameter List:
- /UPN : Displays the user name in the User Principal Name (UPN) format.
- /FQDN : Displays the user name in Fully Qualified Distinguished Name (FQDN) format.
- /USER : Displays information on the current user along with the security identifier (SID).
- /GROUPS : Displays group membership for current user, type of account, security identifiers (SID) and attributes.
- /PRIV : Displays security privileges of the current user.
- /LOGONID : Displays the logon ID of the current user.
- /ALL : Displays the current user name, groups belonged to along with the security identifiers (SID) and privileges for the current user access token.
- /FO format : Specifies the output format to be displayed. Valid values are TABLE, LIST, CSV. Column headings are not displayed with CSV format. The default format is TABLE.
- /NH : Specifies that the column header should not be displayed in the output. This is valid only for TABLE and CSV formats.
- /? : Displays this help message.
I hope this helps.