|
-
Oct 19th, 2009, 10:23 AM
#1
Thread Starter
New Member
LDAP - Get all dommains in forest
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:
Private Sub GCTesting()
Dim oGC As IADs
Dim oDomainEnum As IADs
Dim oDomainBind As IADs
Dim oChild As IADs
Set oGC = GetObject("GC:")
For Each oDomainEnum In oGC
' Print the name of the domain.
Debug.Print oDomainEnum.Name
' Bind to the domain.
Set oDomainBind = GetObject("LDAP://" + oDomainEnum.Name)
' Enumerate the child objects of the domain.
For Each oChild In oDomainBind
Debug.Print " " & oChild.Name
Next
Next
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
-
Oct 19th, 2009, 11:54 PM
#2
Frenzied Member
Re: LDAP - Get all dommains in forest
found this...
http://vbnet.mvps.org/index.html?cod...umprinters.htm
but it says it is for enumerating printers, domains, print providers...
but in the same search using my friends (yahoo, google, ask, answers, bing) I found this...
http://pscode.com/vb/scripts/ShowCod...174&lngWId=-10
Good Luck
Option Explicit should not be an Option!
-
Oct 20th, 2009, 08:41 AM
#3
Thread Starter
New Member
Re: LDAP - Get all dommains in forest
Thanks a lot for the examples, but those will use old WinS API. LDAP is different from that.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|