JSI Tip 7308. The Windows XP and Windows Server 2003 Whoami utility.

Jerold Schulman

October 8, 2003

1 Min Read
ITPro Today logo in a gray background | ITPro Today

When you use the Windows XP CMD help., or Windows Server 2003 CMD help, and press Whoami on the New command-line tools page, you see:

Whoami

Returns domain name, computer name, user name, group names, logon identifier, and privileges for the user who is currently logged on.

Syntax

whoami {/upn | /fqdn | /logonid}

whoami [{/user | /groups | /priv}] [/fo Format]

whoami /all [/fo Format]

Parameters

/upnDisplays the user name in user principal name (UPN) format./fqdnDisplays the user name in fully qualified domain name (FQDN) format./logonidDisplays logon ID./userDisplays the current user name./groupsDisplays group names./privDisplays privileges./fo FormatSpecifies the output format. The following table lists valid Format values.

Value

Description

table

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

list

Displays output in a list.

csv

Displays output in comma-delimited (.csv) format.

/allDisplays the active user name and groups, and the security identifiers (SID) and privileges in the current access token./?Displays help at the command prompt.

Remarks

  • Whoami displays the complete contents of the access token (for example, the current user's security context) in the command window. It displays the user name and security identifier (SID), the group names, types, attributes and their SIDs, the privileges and their status (for example, enabled or disabled), and the logon ID.

Examples

To learn the domain and user name of the person who is currently logged on to this computer, type:

whoami

Whoami returns the domain of the user followed by the user name. Output similar to the following appears in the Command Prompt window:

DOMAIN1administrator

To display all of the information in the current access token, type:

whoami /all



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like