Hi
I need to run several LDAP queries on two Active Directory environments. I'm using ADODB to do this:
My question: if I want to run a second, third, .. query, can I just redefine the objCommand.CommandText and execute it into a new recordset? Or will I lose data from the first query when doing so?
The queries will compare object properties between 2 AD's, so it is important to retain the results from each query.
I need to run several LDAP queries on two Active Directory environments. I'm using ADODB to do this:
Code:
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT adspath FROM 'LDAP://dc=mydomain,dc=com' WHERE objectCategory='user' AND sAMaccountname='MyAccount'"
Set objMyRecordSet = objCommand.Execute
My question: if I want to run a second, third, .. query, can I just redefine the objCommand.CommandText and execute it into a new recordset? Or will I lose data from the first query when doing so?
The queries will compare object properties between 2 AD's, so it is important to retain the results from each query.