LLI Wiki — My Digital Knowledge Base

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.

  1. Open the Registry Editor (regedit).
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters.
  3. Create a String value (REG_SZ) named SiteName.
  4. Set its data to the name of the AD site you want (for example Site-Brussels).

Notes

Mastodon LLIMastodon SocialFosstodon