Check If User Is In Domain – CMD & PowerShell

In Windows, a Local User is the user created in the local system, whose username and password are stored on the computer itself.

A Domain User is one whose username and password are stored on a domain controller (e.g. Active Directory) rather than the computer the user is logging into.

In this note i will show how to determine whether the current user is a Domain User account or a Local User account using the command-line prompt (CMD) or a Windows PowerShell.

Cool Tip: Check if computer is in domain! Read more →

Check If User Is In Domain

To find out whether the current user is a Domain User or a Local User, execute the following commands from the command-line prompt (CMD) or a Windows PowerShell:

C:\> hostname
C:\> whoami

If the current user is logged into the computer using a local account, the whoami command will return hostname\username:

C:\> hostname
DESKTOP-2033

C:\> whoami
desktop-2033\jonsnow

If the user is logged using a domain account, it will return domain\username:

C:\>  hostname
DESKTOP-2033

C:\> whoami
azuread\jonsnow

Cool Tip: Find out what domain controller am i connected to! Read more →