Alright I've been banging my head against the wall for three days on this one, and was hoping someone might have some insight on what could be causing this. I've written several multi-threaded vbscripts in the past to pull various information from multiple domains. However I'm now experiencing an issue I can't seem to solve. I've been querying LDAP to get a list of machines to work with, and it's worked fine for several scripts in the past, and is still working right now, but for what ever reason when I try to dissect the code it will not work on 3 out of the 10 domains I try it on. Here's the code I'm using to connect:
Const conUser = "aaa\user"
Const conPass = "pass"
strDomainName = "aaa.domain.com"
Dim objConnection, objCommand
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = conUser
objConnection.Properties("Password") = conPass
objConnection.Properties("Encrypt Password") = True
objConnection.Properties("ADSI Flag") = 3
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 90000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = 2
objCommand.Properties("Cache Results") = False
objCommand.CommandText = "SELECT ADsPath, pwdLastSet " &_
"FROM 'LDAP://" & strDomainName & "' " &_
"WHERE objectClass='computer'"
WScript.Echo "before execute"
Set objRecordSet = objCommand.Execute
WScript.Echo "after execute"
This code is rather simple and straight forward, all I'm trying to do is load all the entries into a recordset for the "aaa.domain.com" domain. When this works I receive both echo strings, but when it doesn't I receive the following message:
before execute
C:\test.vbs(24, 1) Provider: Table does not exist.
I am almost convinced it has nothing to do with the code and something else is causing this to not work, but I've tried everything I can think of. As I said this is already working on a few other scripts so I've tried it from the servers it's already working on, I've tried from other computers, but still can't pinpoint it, Please Help!
Const conUser = "aaa\user"
Const conPass = "pass"
strDomainName = "aaa.domain.com"
Dim objConnection, objCommand
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = conUser
objConnection.Properties("Password") = conPass
objConnection.Properties("Encrypt Password") = True
objConnection.Properties("ADSI Flag") = 3
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 90000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = 2
objCommand.Properties("Cache Results") = False
objCommand.CommandText = "SELECT ADsPath, pwdLastSet " &_
"FROM 'LDAP://" & strDomainName & "' " &_
"WHERE objectClass='computer'"
WScript.Echo "before execute"
Set objRecordSet = objCommand.Execute
WScript.Echo "after execute"
This code is rather simple and straight forward, all I'm trying to do is load all the entries into a recordset for the "aaa.domain.com" domain. When this works I receive both echo strings, but when it doesn't I receive the following message:
before execute
C:\test.vbs(24, 1) Provider: Table does not exist.
I am almost convinced it has nothing to do with the code and something else is causing this to not work, but I've tried everything I can think of. As I said this is already working on a few other scripts so I've tried it from the servers it's already working on, I've tried from other computers, but still can't pinpoint it, Please Help!