By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,702 Members | 1,101 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,702 IT Pros & Developers. It's quick & easy.

Recursively Searching AD

P: n/a
Hey list, I have another AD question. I can now find things in my AD with
DirectorySearcher, but now I need to recursively search. Our AD is set up
to have lots and lots of containers and I need to look in them all for a
specific CN. Here is what I have so far:

Dim DSESearcher As System.DirectoryServices.DirectorySearcher = New
System.DirectoryServices.DirectorySearcher
Dim RootDSE As String = DSESearcher.SearchRoot.Path
RootDSE = RootDSE.Insert(7, "ou=users,ou=topou,") 'NEED TO SEARCH * ou's
under ou=users
Dim myDE As DirectoryEntry = New DirectoryEntry(RootDSE)
Dim myEntries As DirectoryEntries = myDE.Children
Dim thisentry As DirectoryEntry
thisentry = myEntries.Find("cn=" & lastname)
Label1.Text = thisentry.Name

My AD looks something like this:

users
|
|--> markerting
|--> support
|--> advertising
|--> adver1
|--> adver2
|-->maintenance

If I am at ou=users and need to find someone in adver2 without knowing they
are in adver2 is what I am essentially getting at.

Thanks!
Derek
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.