Querying all domains

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top