PrincipalContext ctx = new PrincipalContext(ContextType.Domain); IPAddress[] ip = Dns.GetHostAddresses(ctx.ConnectedServer.Split('.').GetValue(0).ToString()); DirectoryEntry dirEn = new DirectoryEntry(String.Format("LDAP://" + ip[0] + " x.y.com","DC=x,DC=y, DC=com")); DirectorySearcher dirSearcher = new DirectorySearcher(dirEn); SearchResultCollection result; dirSearcher.Filter="(&(ObjectClass=computer))"; result = dirSearcher.FindAll();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)