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

Enumerate all domains in a forest

P: n/a
Can anyone help me on how to enumerate all the domains in a forest with
VB.NET.

Thanks,
Dan Rhoads
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi

Here is the sample code.

Module Module1
Sub Main()
Dim forest, child
forest = GetObject("GC://DC=ForestName,DC=Company,DC=COM") 'Path to
forest
For Each child In forest
If Not child.DC = "" Then ' if child.DC is not empty, then it
is a Domain
Console.WriteLine(child.DC) 'print the domain name
End If
Next
End Sub
End Module
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.