TechOnTip Weblog

Run book for Technocrats

WHOAMI – command

Posted by Brajesh Panda on January 21, 2014

Well lately I learned about this command. Pretty interesting & helpful. Specially finding out UPN, Groups the user account belongs to.

Here is the help file for this command

PS C:\> whoami /?

WhoAmI has three ways of working:

Syntax 1:

WHOAMI [/UPN | /FQDN | /LOGONID]

Syntax 2:

WHOAMI { [/USER] [/GROUPS] [/CLAIMS] [/PRIV] } [/FO format] [/NH]

Syntax 3:

WHOAMI /ALL [/FO format] [/NH]

Description:

This utility can be used to get user name and group information

along with the respective security identifiers (SID), claims,

privileges, logon identifier (logon ID) for the current user

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).

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.

/CLAIMS Displays claims for current user,

including claim name, flags, type and values.

/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), claims 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.

Examples:

WHOAMI

WHOAMI /UPN

WHOAMI /FQDN

WHOAMI /LOGONID

WHOAMI /USER

WHOAMI /USER /FO LIST

WHOAMI /USER /FO CSV

WHOAMI /GROUPS

WHOAMI /GROUPS /FO CSV /NH

WHOAMI /CLAIMS

WHOAMI /CLAIMS /FO LIST

WHOAMI /PRIV

WHOAMI /PRIV /FO TABLE

WHOAMI /USER /GROUPS

WHOAMI /USER /GROUPS /CLAIMS /PRIV

WHOAMI /ALL

WHOAMI /ALL /FO LIST

WHOAMI /ALL /FO CSV /NH

WHOAMI /?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: