Querying all domains

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

To all,

I was wondering if anyone knows how to query for all the domains that exist
in an Active directory? I'm using VB.NET and have the lines of code below to
search for users within a specific domain.

However, I want the user on my webform to choose a domain to search for
their object (e.g. user).

I would like to change my directory entry for my object to search against
the domain that was chosen by a user. However, before I do this I would like
to build a query that returns all the domain names from my root.


Here is what I'm hard coding for now:
Dim objADEntry As System.DirectoryServices.DirectoryEntry = New
System.DirectoryServices.DirectoryEntry("LDAP://DC=DomainX,DC=FOO,DC=COM")

Dim objSearcher As System.DirectoryServices.DirectorySearcher = New
System.DirectoryServices.DirectorySearcher(objADEntry)

objSearcher.Filter = ("CN=John Doe")

Thanks for any advice,
Michael
 
Back
Top