Not many of you may be aware of it, but Windows has a command-line utility called as the WHOAMI utility (Who Am I). With this utility, you can find out the name of the account that’s currently logged on, its SID, the names of the security groups of which it’s a member, and its privileges. The tool was introduced in Windows Vista onwards – but it is also available as part of the Windows 2000 Resource Kit and Windows XP SP2 Support Tools. We had touched upon this tool briefly in our WinVistaClub post earlier, but are giving a few more details about it here.
WHOAMI in Windows
The whoami utility can be used to get 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 current logged on user? If no switch is specified, 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 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. 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.
Windows XP users may download the support tools from here.