SearchGlobalCatalog Method

Performs the global catalog query specified by Query and returns the number of objects that match the query.


ActiveDirectory.SearchGlobalCatalog(Query String)


Query Specifies the query to perform in the form of an LDAP query.

Return Type

Long. Returns -1 if an error occurred.


To determine the time required to search the global catalog, enter:

Dim objActiveDirectory
Dim lngObjectCount, lngSearchTime

Set objActiveDirectory = CreateObject("McActiveDir.ActiveDirectory")

lngObjectCount = objActiveDirectory.SearchGlobalCatalog("(objectCategory=person)")
If lngObjectCount >= 0 Then
lngSearchTime = objActiveDirectory.GlobalCatalogSearchTime
End If

Set objActiveDirectory = Nothing

This example determines the amount of time to search the global catalog for all person objects.