If you logon to a domain you can get the IP address of the active directory server by executing the following steps:

start > cmd > echo %LOGONSERVER%


You could also try to ping you’re domain:

start > cmd > ping mydomain.local


If you want to determine the domain controller name in C#, use:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices.AccountManagement;

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            using (PrincipalContext context = new PrincipalContext(ContextType.Domain))
                string controller = context.ConnectedServer;
                Console.WriteLine(string.Format("Domain Controller: {0}", controller));
                Console.WriteLine("Press any key to exit.");




Leave a Reply

Your email address will not be published. Required fields are marked *

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