Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enumerate all domains in a forest

13 views
Skip to first unread message

night...@nospam.nospam

unread,
May 10, 2005, 3:12:59 PM5/10/05
to
Can anyone help me on how to enumerate all the domains in a forest with
VB.NET.

Thanks,
Dan Rhoads


Peter Huang [MSFT]

unread,
May 10, 2005, 10:49:25 PM5/10/05
to
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.

0 new messages