I have code in a VB 6 app that scans thru a single forrest right now and I'm trying to figure out how to grab the second forrest. What does Global Catalog give me for Acive Directory? Both forrest can be accessed by the single server (MS domain), what code segements do I need to add to scan for the second forrest? Thanks in advance!
Dano
dan_kryzer@hotmail.com
What's your major malfunction
Code:
'ADO Connection object
Set con = CreateObject("ADODB.Connection")
con.Provider = "ADsDSOObject"
con.Open "Active Directory Provider"
'ADO Command object
Set ocommand = CreateObject("ADODB.Command")
ocommand.ActiveConnection = con
Set gc = GetObject("GC:")
For Each child In gc
Set entpr = child
Next
ocommand.Properties("Page size") = 10000
ocommand.CommandText = "<" & entpr.ADsPath & ">;(&(objectCategory=group)(objectClass=group));distinguishedName;subTree"
Set rs = ocommand.Execute
rval = ""
rs.MoveFirst
While Not rs.EOF
description = "(null)"
intranet = "(null)"
extranet = "(null)"
countrycode = "(null)"
department = "(null)"
salesteam = "(null)"
application = "(null)"
departspecific = "(null)"
financialcompany = "(null)"
customer = "(null)"
stellentcode = "(null)"
computedcountry = "(null)"
On Error GoTo nextelement
dn = rs.Fields(0)
timeObj = Timer
writeDebugMessage ("time =" & timeObj & "- dn = " & dn)
Set oGrp = GetObject("LDAP://" & dn)
'Determine if this group should be included
IncludeGroup = False
On Error GoTo resetintranet
oGrp.GetInfoEx Array("dimon-cmintranet"), 0
intranet = oGrp.Get("dimon-cmintranet")
'writeDebugMessage ("intranet = " & intranet)
On Error GoTo resetextranet
oGrp.GetInfoEx Array("dimon-cmextranet"), 0
extranet = oGrp.Get("dimon-cmextranet")
'writeDebugMessage ("extranet = " & extranet)
If (getIntranet) Then
If (intranet = "1") Then
IncludeGroup = True
End If
End If
If (getExtranet) Then
If (extranet = "1") Then
IncludeGroup = True
End If
End If
If (IncludeGroup) Then
description = oGrp.Get("cn")
'writeDebugMessage ("description = " & description)
oGrp.GetInfoEx Array("dimon-cmcountrycode", "dimon-cmdepartment", _
"dimon-cmsalesgroup", "dimon-cmapplication", _
"dimon-cmdepartmentspecific", "dimon-cmfinancialcompany", _
"dimon-cmextranetcustomer", "dimon-cmcode"), 0
On Error GoTo resetcountrycode
countrycode = oGrp.Get("dimon-cmcountrycode")
'writeDebugMessage ("countrycode = " & countrycode)
On Error GoTo resetdepartment
department = oGrp.Get("dimon-cmdepartment")
'writeDebugMessage ("department = " & department)
On Error GoTo resetsalesteam
salesteam = oGrp.Get("dimon-cmsalesgroup")
'writeDebugMessage ("salesteam = " & salesteam)
On Error GoTo resetapplication
application = oGrp.Get("dimon-cmapplication")
'writeDebugMessage ("application = " & application)
On Error GoTo resetdepartspecific
departspecific = oGrp.Get("dimon-cmdepartmentspecific")
'writeDebugMessage ("departspecific = " & departspecific)
On Error GoTo resetfinancialcompany
financialcompany = oGrp.Get("dimon-cmfinancialcompany")
'writeDebugMessage ("financialcompany = " & financialcompany)
On Error GoTo resetcustomer
customer = oGrp.Get("dimon-cmextranetcustomer")
'writeDebugMessage ("customer = " & customer)
On Error GoTo resetstellentcode
stellentcode = oGrp.Get("dimon-cmcode")
'writeDebugMessage ("stellentcode = " & stellentcode)
If (department = "1" Or departspecific <> "(null)") Then
If (stellentcode <> "(null)") Then
computedcountry = Left(stellentcode, 2)
End If
End If
If (countrycode = "1") Then
If (stellentcode <> "(null)") Then
stellentcode = Left(stellentcode, 2)
End If
End If
If (Len(rval) > 0) Then
rval = rval & ";"
End If
rval = rval & description & "^" & intranet & "^" & extranet & "^" & countrycode & "^" & _
department & "^" & salesteam & "^" & _
application & "^" & departspecific & "^" & financialcompany & "^" & customer & _
"^" & stellentcode & "^" & dn & "^" & computedcountry
writeDebugMessage ("rval = " & rval)
End If
mn:
rs.MoveNext
Wend
loadAllMetaForCache = rval
writeDebugMessage ("----- End loadAllMetaForCache() ---------")
Exit Function
nextelement:
Resume mn
resetdescription:
description = "(null)"
Resume Next
resetintranet:
intranet = "(null)"
Resume Next
resetextranet:
extranet = "(null)"
Resume Next
resetcountrycode:
countrycode = "(null)"
Resume Next
resetdepartment:
department = "(null)"
Resume Next
resetsalesteam:
salesteam = "(null)"
Resume Next
resetapplication:
application = "(null)"
Resume Next
resetdepartspecific:
departspecific = "(null)"
Resume Next
resetfinancialcompany:
financialcompany = "(null)"
Resume Next
resetcustomer:
customer = "(null)"
Resume Next
resetstellentcode:
stellentcode = "(null)"
Resume Next
Dano
dan_kryzer@hotmail.com
What's your major malfunction