If you work in I.T and manage a domain environment then you may come across the need to determine which domain controller you or a particular PC has authenticated to. If you have more than one Domain Controller in your environment, a system could authenticate randomly to one of them depending on the set-up. Finding out which logon server you are authenticated to may be handy if you are troubleshooting whether or not the local DC is functioning correctly, or testing a group policy, slow logins, application issues, network drive mappings and so on. This article will show you how to find your logon server using both the command prompt and Powershell.
How to find your Logon Server
There is two methods you can use to check the logon server you are authenticated to. You can use either the command line or Windows PowerShell.
Option 1 – Using the Command Line to find your logon server
There are two commands you can run to find out the local domain controller you are authenticated to. Open the command line, type either of the commands below and press enter
set l (or you can type the full command - set logonserver)
echo %logonserver%
nltest/dsgetdc:[FQDN]
In the screenshots above. the outputs display that I have authenticated to the FP-DC2 domain controller.
Option 2 – Using PowerShell
Open PowerShell, type the command below, and press enter
$env:LOGONSERVER
Find Domain Controller Group Policy Was Applied From
If you just desire to identify which domain controller the user retrieved group policies from you can type gpresult /r. The returned results will provide you the name of the domain controller that provided the logged on user with GPOs.
gpresult /r
You can see in the above screenshot the group policy was applied from FP-DC2. Sometimes the computer setings policy and the user settings policy can be applied from different logon servers so make sure you check the user settings section also.