public BaseDirectoryServices(string serverName) { m_serverName = serverName; if (DirectoryServicesUtils.IsLocalMachine(serverName)) { m_directorySearchRoot = new DirectoryEntry(DirectoryServicesUtils.LOCAL_SEARCH_PROTOCOL + serverName + ",Computer"); } else { m_directorySearchRoot = new DirectoryEntry(DirectoryServicesUtils.DOMAIN_SEARCH_PROTOCOL + serverName); } }
private static BaseDirectoryServices GetServerDS(string serverName) { BaseDirectoryServices serverDS; m_serverDSCache.TryGetValue(serverName, out serverDS); if (serverDS == null) { if (DirectoryServicesUtils.IsLocalMachine(serverName)) { serverDS = new LocalDirectoryServices(serverName); } else { serverDS = new DomainDirectoryServices(serverName); } m_serverDSCache.Add(serverName, serverDS); } return(serverDS); }