Command Reference
whoami
Gnojo Analysis
Understanding whoami
What This Command Does
whoami displays information about the currently logged-on user and their security context (account name, SID, groups, and privileges) on Windows.
When to Use It
Use whoami when troubleshooting networking issues and you need information that can help narrow down the cause.
What to Look For
/USER
Reveals the user and SID; useful to confirm which account (and SID) the process is running under.
/GROUPS -> Attributes
Indicates group influence on access (e.g., Deny-only, Mandatory, Enabled by default). Critical when troubleshooting permission issues.
/PRIV -> State
Shows whether sensitive privileges (e.g., SeBackupPrivilege) are enabled; affects ability to perform certain actions.
/LOGONID
Identifies the specific logon session (LUID), helping correlate with security logs or session diagnostics.
Permissions
Administrator access is not normally required for this command.
Risk and impact
Reveals identity and security details to the console; avoid sharing outputs that contain sensitive SIDs or account names.
Summary
whoami displays information about the currently logged-on user and their security context (account name, SID, groups, and privileges) on Windows.
Syntax
whoami [/UPN] [/FQDN] [/LOGONID] [/USER] [/GROUPS] [/PRIV] [/ALL]
Examples
whoami
Shows the current user in DOMAIN\User or COMPUTERNAME\User format.
whoami /upn
Displays the current user as a User Principal Name (UPN), e.g., user@contoso.com (requires domain account).
whoami /fqdn
Displays the user name using the domain's fully qualified domain name (FQDN), e.g., corp.contoso.com\user (requires domain context).
whoami /user
Shows the current user and their Security Identifier (SID).
whoami /groups
Lists group memberships and attributes (e.g., Mandatory, Enabled, Deny-only).
whoami /priv
Lists security privileges in the current logon token and whether each is enabled or disabled.
whoami /all
Displays comprehensive identity details: user, SID, groups, privileges, and logon information.
whoami /logonid
Shows the hexadecimal logon session ID (LUID) for the current session.
Permissions
Administrator required: No
whoami reads the current token and does not modify system state. It works for standard users; some fields may vary based on token filtering or service contexts.
Risk and Impact
Risk level: Low
Changes the system: No
Reveals identity and security details to the console; avoid sharing outputs that contain sensitive SIDs or account names.
Supported Platforms
Important Output Fields
/USER
Reveals the user and SID; useful to confirm which account (and SID) the process is running under.
/GROUPS -> Attributes
Indicates group influence on access (e.g., Deny-only, Mandatory, Enabled by default). Critical when troubleshooting permission issues.
/PRIV -> State
Shows whether sensitive privileges (e.g., SeBackupPrivilege) are enabled; affects ability to perform certain actions.
/LOGONID
Identifies the specific logon session (LUID), helping correlate with security logs or session diagnostics.
/UPN
Outputs user@domain format; helpful for SSO/Kerberos troubleshooting in domain environments.
/FQDN
Displays the user with the domain’s FQDN; helps avoid ambiguity with NetBIOS names.
Common Errors
'whoami' is not recognized as an internal or external command, operable program or batch file.
Occurs if system paths to System32 are missing from PATH, the binary is unavailable, or on very old/stripped environments. Run from %SystemRoot%\System32 or fix PATH.
ERROR: Invalid syntax. Type "WHOAMI /?" for usage.
Triggered by unsupported or misspelled switches (e.g., /domain). Use whoami /? to see valid options.
UPN/FQDN not available for this account.
The account is local or the system cannot contact a domain controller. Ensure the user is a domain account and the DC is reachable.
Insufficient resources to complete the operation.
Rare; indicates a transient system resource issue when querying token details. Retry or check system health.
Official References
whoami (Windows Commands)
Microsoft Learn · Official Documentation