I need to return a list of servers and domain controllers
from active
directory. This is what I have:
DirectoryEntry ADEntry = new
DirectoryEntry("LDAP://myDomain");
DirectorySearcher ADSearcher = new
DirectorySearcher(ADEntry);
ADSearcher.Filter =
"(&(objectCategory=computer))";
The above works and will return all computers.
How do I narrow it down to return the servers? How to
narraow it down
to return domain controllers?
I tried changing the ADSearch.Filter to
"(&(objectCategory=group)(ou=Domain
Controllers))";
This didn't work.
Thanks!
|