
How to query a non-Windows LDAP server using ADSI and vbscript
I apologize for the cross-post, but I think the expertise to answer my
question covers both newsgroups.
I'm trying to connect to an OpenLDAP server using ADSI and VBScript and
having no luck. I think I'm using the wrong provider, but I don't have any
idea which one to use. Below is the vbscript I wrote to try and read all
the DNs in a particular OU. Unfortunately, I continually get the following
error: "Provider: Table does not exist." What provider should I be using?
Thanks!
Dave
-------------script begins here ------------------------
Option Explicit
Dim objConnection, objCommand, objRecordSet, intIndex
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://ldap.andrew.cmu.edu/ou=accounts,dc=andrew,dc=cmu,dc=edu>;" & _
"(objectClass=cmuPerson);cmuAndrewId;onelevel"
Set objRecordSet = objCommand.Execute
If objRecordset.RecordCount = 0 Then
WScript.Echo "Can't find any records."
Wscript.Quit
End If
While Not objRecordset.EOF
Wscript.Echo intIndex & vbTab & objRecordset.Fields(0).value
objRecordset.MoveNext
intIndex = intIndex + 1
Wend
objConnection.Close
--------------------- script ends here -----------------------