Trying to connect to LDAP server using a vbscript to pull information out
This is what I have. Get error when get to recordset
Error = line 24
either BOF or EOF is True, or the current record has been deleted. Requester operation requires a current record
Const ADS_SCOPE_SUBTREE = 2
strNDSUserName="cn=user,ou=orgunit,ou=orgunit,o=root"
strPassword="password"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = strNDSUserName
objConnection.Properties("Password") = strPassword
objConnection.Open "ADSI"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT AdsPath FROM 'LDAP://server/ou=orgunit,o=root' WHERE objectlass='user'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("userobject").Value
objRecordSet.MoveNext
Loop
This is what I have. Get error when get to recordset
Error = line 24
either BOF or EOF is True, or the current record has been deleted. Requester operation requires a current record
Const ADS_SCOPE_SUBTREE = 2
strNDSUserName="cn=user,ou=orgunit,ou=orgunit,o=root"
strPassword="password"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = strNDSUserName
objConnection.Properties("Password") = strPassword
objConnection.Open "ADSI"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT AdsPath FROM 'LDAP://server/ou=orgunit,o=root' WHERE objectlass='user'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("userobject").Value
objRecordSet.MoveNext
Loop