Hi!

I am trying to get all domain names in the whole forest. Let me try to picture the scenario:

**Entire directory
->Domain_1.com (my computer belongs to this domain!!)
-Builtin
-Computers
-Domain Controllers
-Subomain1.Domain_1.com
-Subomain2.Domain_1.com
-etc...
**Domain_2.com
**Domain_3.com

I have tried the classic examples on the Internet, but all of them will get me everything under the Entire directory (because that's where my computer belongs).

Now, what I need is to get the names for ALL domains, including the ones that are outside Entire Directory (Domain_2.com and Domain_3.com).

I though I would be able to achieve this by calling the global directory, but it will still only get me info only for Domain_1.com
vb Code:
  1. Private Sub GCTesting()
  2.     Dim oGC As IADs
  3.     Dim oDomainEnum As IADs
  4.     Dim oDomainBind As IADs
  5.     Dim oChild As IADs
  6.    
  7.     Set oGC = GetObject("GC:")
  8.     For Each oDomainEnum In oGC
  9.         ' Print the name of the domain.
  10.         Debug.Print oDomainEnum.Name
  11.        
  12.         ' Bind to the domain.
  13.         Set oDomainBind = GetObject("LDAP://" + oDomainEnum.Name)
  14.        
  15.         ' Enumerate the child objects of the domain.
  16.         For Each oChild In oDomainBind
  17.             Debug.Print "  " & oChild.Name
  18.         Next
  19.     Next
  20.    
  21. End Sub
Is it actually possible to get all domain names (even the ones outside Entire Directory)? I think it should be possible somehow, since I can see the Domain_2.com and Domain_3.com by looking at the windows Location screen. So if I can see it from windows, I guess it should be also possible to do it from VB6.

I appreciate any help on this