From: www.itworld.com
July 10, 2008 —
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:
|
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