2
votes

Foreword:

I'm using two domain controller (dc1 and dc2). I'm using a domain registered to the root domain dc1 and simply request all of the domains in its forest by preforming search in the CN=Partitions,CN=Configuration,DC=dc1,dc=local.

I can also get the root domain dns of my trusted forest (dc2) from the default naming context under "CN=System" by looking for an object of type "trustedDomain".

The problem:

The problem is that I can't see/find the other domains (childs) of the root domain dc2 from the active directory information found in dc1. In order to get these domains I currently bind to this domain controller (dc2) and preform the same search as I did in the domain controller dc1 (CN=Partitions,CN=Configuration,DC=dc2,dc=local) to get all its childs.

Must I use this binding to each root domain in other forest in order to request all of its domains? Is there a better way to do it? I read about referrals which seems like a solution to my problem but I'm not sure if it is and I'm not sure how it should be used.

Note : I'm using the DirectoryEntry class in C#.

1
have you considered trying your search against the global catalog server port (3268)? The global catalog has a subset of data but the scope is the entire forest. It may suit your needs.Dave Bennett
I did try to use GC prefix instead of LDAP prefix in order to search against the global catalog server and I got the same results. @DaveBennett Do you have an idea how is it possible ?SyndicatorBBB
Also notice I'm taking about domains from OTHER forest. I'm not looking for other domains in MY forest.SyndicatorBBB

1 Answers

1
votes

No, you cannot get all domains of forest1 by searching in forest2,
at least not to my knowledge.

A search for "trustedDomain" will only give you the domains involved directly in trust relations. For example, for a forest trust, you only get the root but not its children.

So, I think you have to search each forest.
A simpler way is to search for all "domainDNS" object in GC of each forest. Partitions also include those schema and configuration ones.