What Domain Controller Am I Connected To – CMD & PowerShell

Windows Domain Controller (DC) is a server that responds to security authentication requests within a Windows Domain (group of networked computers controlled by domain controller).

In this short note i will show how to find out which DC a computer is authenticated to using Windows CMD and PowerShell.

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

What Domain Controller Am I Connected To

Get domain controller name in Windows CMD:

C:\> echo %LogOnServer%

Get domain controller name in PowerShell:

PS C:\> $env:LogOnServer

To find out the FQDN and IP address of the domain controller, you can use nslookup command that works both in Windows CMD and PowerShell:

C:\> nslookup MYDOMAINCONTROLLER01