Whoami

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

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}] [/foFormat]

whoami /all [/foFormat]

Parameters
  • /upn
    Displays the user name in user principal name (UPN) format.
  • /fqdn
    Displays the user name in fully qualified domain name (FQDN) format.
  • /logonid
    Displays logon ID.
  • /user
    Displays the current user name.
  • /groups
    Displays group names.
  • /priv
    Displays privileges.
  • /fo Format
    Specifies the output format. The following table lists valid Format values.
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="header">
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><p><strong>table</strong></p></td>
<td><p>Displays output in a table. This is the default value.</p></td>
</tr>
<tr class="even">
<td><p><strong>list</strong></p></td>
<td><p>Displays output in a list.</p></td>
</tr>
<tr class="odd">
<td><p><strong>csv</strong></p></td>
<td><p>Displays output in comma-delimited (.csv) format.</p></td>
</tr>
</tbody>
</table>
  • /all
    Displays 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:

DOMAIN1\administrator

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

whoami /all

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Command-line reference A-Z
Command shell overview