I would like to enumerate all DCs in a domain (where current user nor computer are member of, and also not in the same forest).
I found this nice method
Domain domain = Domain.GetCurrentDomain();
foreach (DomainController dc in domain.DomainControllers)
...
However, I could not figure out how to do a remote connect with to
get the right domain context.
Connecting via
DirectoryEntry child = new DirectoryEntry("LDAP://" + server + "/" + objectDn, userName, password);
works well. But I have no Idea how to get this together.
…
….
the above works for me (gives the correct domain count)
I am testing with a network admin account obviously. Hope this helps