 <p>I've done the exact same thing few weeks ago. I used the <code>System.DirectoryServices.ActiveDirectory</code> library, and used the <code>Domain</code> and <code>DomainController</code> objects to find what you are looking for.</p> <p>Here is the code I'm using:</p> <pre><code>public static class DomainManager { static DomainManager() { Domain domain = null; DomainController domainController = null; try { domain = Domain.GetCurrentDomain(); DomainName = domain.Name; domainController = domain.PdcRoleOwner; DomainControllerName = domainController.Name.Split('.')[0]; ComputerName = Environment.MachineName; } finally { if (domain != null) domain.Dispose(); if (domainController != null) domainController.Dispose(); } } public static string DomainControllerName { get; private set; } public static string ComputerName { get; private set; } public static string DomainName { get; private set; } public static string DomainPath { get { bool bFirst = true; StringBuilder sbReturn = new StringBuilder(200); string[] strlstDc = DomainName.Split('.'); foreach (string strDc in strlstDc) { if (bFirst) { sbReturn.Append("DC="); bFirst = false; } else sbReturn.Append(",DC="); sbReturn.Append(strDc); } return sbReturn.ToString(); } } public static string RootPath { get { return string.Format("LDAP://{0}/{1}", DomainName, DomainPath); } } } </code></pre> <p>And then, You simply call <code>DomainManager.DomainPath</code>, everything is initialized once (it avoids resource leaks) or <code>DomainName</code> and so on. Or RootPath, which is very useful to initialize the root <code>DirectoryEntry</code> for <code>DirectorySearcher</code>.</p> <p>I hope this answers your question and could help.</p>