List and switch the Active Directory domain controller
nltest commands to list domain controllers, find the one a Windows computer uses and switch to another one.
This page explains how to list the domain controllers (DCs) of an Active Directory domain, find the one a Windows computer uses, and switch to another one, using nltest.
List the domain controllers
nltest /dclist:example.com
Find the current domain controller
From the computer's command prompt, show the logon server:
echo %LOGONSERVER%
To ask for the DC used for a given domain:
nltest /dsgetdc:example.com
Open the command prompt with a domain administrator account: hold Shift, right-click "Command Prompt", then select "Run as different user".
Switch the domain controller
From a command prompt started with a domain administrator account:
nltest /Server:dc01 /SC_RESET:DomainName\DomainControllerName
Set the domain controller via the registry
This method selects the Active Directory site the computer uses to locate a DC.
- Open the Registry Editor (
regedit). - Go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters. - Create a String value (REG_SZ) named
SiteName. - Set its data to the name of the AD site you want (for example
Site-Brussels).
Notes
- The
SiteNamevalue expects an Active Directory site name, not the name of a DC. The source note gave a DC name; this article uses the site name. - Real names were replaced with generic values (
example.com,dc01,DomainName\DomainControllerName,Site-Brussels). - To monitor LDAP traffic with performance counters, see Performance counters to monitor LDAP traffic.
- For the domain controller switch procedure, see also Windows: how to switch domain controller.