Windows 7 | 8 | 10 Command Line: WhoAmI

WhoAmI is a very powerful command utility in Windows 7 that easily reveals so much about you as the current user on your computer, including your login name, groups you belong to, privileges, etc. Released as a tool part of Windows XP resource kit, it has made its way becoming the official built-in tool since Vista.

Syntax

whoami [/upn | /fqdn | /logonid]
whoami {[/user] [/groups] [/priv]} [/fo ] [/nh]
whoami /all [/fo ] [/nh]

Now let’s take look some of the examples.

Use without any parameters

whoami displays the current domain and username or computer name and username if the user does not belong to the domain.

image

To find which group you belong to

whoami /groups

image

If the current user is a domain user, whoami also lists the domain groups the current user belong to.

What is my SID and LogonID?

To find out what your SSID is, use

whoami /user

image

To see what your LogonID is, use

whoami /logonid

image

To see my FDQN, if I am joined to the domain

whoami /fqdn

The command is only available when the current user is a domain-based user.

Ok, please give me all

whoami /all

The output format is ugly

You can use switch /fo with three formatting options to optimize the output, either table, which is by default, list, or CSV. If you are using CSV, you can export to a file that can be opened in your Excel.

To display the output in List format.

whoami /all /fo list

image

To export the output to a file in your Documents folder, use “>” at the end of the command.

whoami /all /fo CSV >%userprofile%\documents\myinfo.csv

You won’t see any output in the Dos command window, but instead, you will be able to open the saved file in Excel.

image

What if I am still running XP?

Fortunately, you can download it from this link and install it on your computer.

Kent Chen

Microsoft MVP, IT Professional, Developer, Geek, and the co-founder of Next of Windows.

Last updated: 08/22/2016

Posted in: Tips & Tricks
Discover more: ,