List of Windows DCs

Original posts:

Your own logon server:


Own logon server with C#:

using System.DirectoryServices.AccountManagement;
// (also need to add the assembly System.DirectoryServices.AccountManagement)

using (PrincipalContext context = new PrincipalContext(ContextType.Domain))
    string controller = context.ConnectedServer;
    Console.WriteLine( "Domain Controller:" + controller );

List of all domain controllers in particular domain:

nltest /dclist:{domainname}

List of all domain controllers computer is connected to:

nltest /dclist:

Leave a Reply