by Paul McFedries
Windows

Who's Logged On?

Be the first to comment | 25I like it!
July 10, 2008, 05:28 AM — 

How do you know who's logged on to a Vista machine? For example, what if you're sitting down at a client computer and you're not sure who's logged on and what privileges they have?

No problem. You can use the WHOAMI command to get all kinds of useful information about the user who is currently logged on to the computer. Here's the syntax:

WHOAMI [/UPN | /FQDN | LOGONID] [/USER | /GROUPS | /PRIV] [/ALL] [/FO format]

/UPN (Domains only) Returns the current user's name using the user principal name (UPN) format.
/FQDN (Domains only) Returns the current user's name using the fully qualified domain name (FQDN) format.
/LOGONID Returns the current user's security identifier (SID).
/USER Returns the current username using the computer\user format.
/GROUPS Returns the groups of which the current user is a member.
/PRIV Returns the current user's privileges.
/ALL Returns the current user's SID, username, groups, and privileges.
/FO format The output format, where format is one of the following values:

table The output is displayed in a row-and-column format, with headers in the first row and values in subsequent rows.
list The output is displayed in a two-column list, with the headers in the first column and values in the second column.
csv The output is displayed with headers and values separated by commas. The headers appear on the first line.

For example, start a Command Prompt session on the computer (select Start, type command in the Search box, and then press Enter) and enter the following command, which redirects the current user's SID, username, groups, and privileges to a file named whoami.txt using the list format, and then opens the file:

whoami /all /fo list > whoami.txt&&start whoami.txt

I like it!
Post a comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
Free books

Build your tech library with our book giveaways.

Windows PowerShell 2.0 Unleashed
By Tyson Kopczynski, Pete Handley, Marco Shaw; Published by Sams

Windows PowerShell Unleashed will not only give you deep mastery over PowerShell but also a greater understanding of the features being introduced in PowerShell 2.0–and show you how to use it to solve your challenges in your production environment. Enter now!

 

Ubuntu Server Administration
By Michael Jang; Published by McGraw-Hill Osborne Media

Realize a dynamic, stable, and secure Ubuntu Server environment with expert guidance, tips, and techniques from a Linux professional. Ubuntu Server Administration covers every facet of system management -- from users and file systems to performance tuning and troubleshooting. Enter now!

Featured Sponsor

AISO founders envisioned a Web hosting company that was environmentally friendly. While the company employed energy-efficient innovations like solar panels, its infrastructure produced unacceptable power and cooling requirements. Find out how AISO leveraged AMD technology to overcome their challenge in this case study white paper.

In this whitepaper, Scalar explores the opportunity to change the landscape with respect to mission critical databases built around Oracle. Leveraging technologies such as Linux, high-end commodity processing power and Oracle RAC technology to architect, design, build and maintain database infrastructure that delivers maximum availability, reliability and performance at a fraction of traditional cost.

On a typical day, weather.com, the Web site for The Weather Channel in Atlanta, serves up between 15 million and 20 million page views. But in September 2004, when back-to-back hurricanes ransacked Florida, the peak traffic on one day more than tripled: over 70 million page views by more than 7 million unique visitors. Read the full success story now.

More Resources