TechOnTip Weblog

Run book for Technocrats

Archive for January, 2014

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 /?

Posted in Mix & Match | Leave a Comment »

Add a Single Line to PowerShell Output like Echo

Posted by Brajesh Panda on January 13, 2014

Write-output "My Output Text"`n | Out-File Latam-Report.txt -Append

Tips

Posted in Mix & Match, Powershell | Tagged: | Leave a Comment »

 
%d bloggers like this: