How to find out which Domain Controller my PC is talking to?


One very useful piece of information to know, if you’re working in large Active Directory implementation with multiple DC’s and Sites, is to be able to determine which Domain Controller machines are authenticating against at any given time.

Here’s the command to tell us exactly that:

nltest /dsgetdc:domain_name

Rather handy if you’re testing whether Sites and Services have been setup correctly or are moving computer objects in Active Directory and want the quickest turnaround for GPO’s etc.

You could always use built-in ‘set l’ command but that’s not always accurate due to %logonserver% variable taking a bit of time to update if you change Active Directory site and ultimately domain controller you’re authentication against. Remote workers are good example as they tend to be all over the place and ‘set l’ might give misleading and not precise results.

7 thoughts on “How to find out which Domain Controller my PC is talking to?

  1. Adrian Kielbowicz Post author

    %logonserver% variable is not always accurate as it needs to be replicated to show the most up to date information. If you assume that you have been working on subnet that’s part of Active Directry site that talks to domain controller called DC1 and then moved to different site talking to DC2 running echo %logonserver% straight after the move would show that your machine is still talking to DC1. This is where its best to use ‘nltest’ but I appreciate that sometimes its easier to use ‘set l’ or ‘echo %logonserver%’ as both commands are built in.

  2. Adrian Kielbowicz Post author

    That’s a tough one, let me do some research and come back to you (don’t know the answer from top of my head..)

    Which Linux distribution do you have?

  3. escott

    Is there a command to change the logon server? E.g., I move a machine from one city to another (same domain), but it’s still trying to contact the old DC.

  4. Adrian Kielbowicz Post author

    How are your Sites and Services setup? Do you have the IP subnets configured properly and assigned to relevant sites? You shouldn’t need to force the logon server change from the machine point of view (this happens automatically assuming Sites and Servers and configured correctly)

  5. Anirban Paul

    May i know,when user login to client machine in ad environment during that which services find the dns details

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.