LDP ADO Equivalence
- From: "Grant Schenck" <schenckg@xxxxxxxxxxxxx>
- Date: Mon, 27 Feb 2006 13:43:45 -0500
I'm getting started with LDAP and am thrashing around. I used the MS
utility LDP to browse our corporate domain controller and was able to get
some standing. I then created a VB script and by modifying some WEB samples
could make queries and display results using ADO from our DC. All very
nice.
I then wanted to play with public LDAP directories to understand what parts
are generic, etc. I found a site which lists various public LDAP
directories:
http://www.emailman.com/ldap/public.html
I selected one (UPENN, my old University) and used LDP to run some searches.
After some thrashing about I was able to get some queries to work from LDP.
My Question is how do I get the equivalent to work from VBScript using ADO?
I believe it has something to do with my credentials, specifically a need to
bind with a null User ID/PW. However, my understanding of ADO and LDAP is
primitive. Do I have to do something for the equivalent to LDP's Bind?
I seem to get "Provider: Table does not exist."
This shows a log from LDP:
---------------------------------------------------------------------
ld = ldap_open("directory.upenn.edu", 389);
Established connection to directory.upenn.edu.
Retrieving base DSA information...
Result <0>: (null)
Matched DNs:
Getting 1 entries:
2> objectClass: top; OpenLDAProotDSE;Dn:
-----------
res = ldap_simple_bind_s(ld, 'NULL', <unavailable>); // v.3
Authenticated as dn:'NULL'.
***Searching...
ldap_search_s(ld, "ou=People,o=upenn.edu", 1, "sn=ESPE*", attrList, 0,
&msg)
Result <0>: (null)
Matched DNs:
Getting 3 entries:
1> sn: ESPEY;Dn: uid=despey,ou=people,o=upenn.edu
1> sn: ESPENLAUB;Dn: uid=staceye,ou=people,o=upenn.edu
1> sn: ESPELETA JR;Dn: uid=espeletj,ou=people,o=upenn.edu
---------------------------------------------------------------------
This shows my ADO VBScript code
' Use ADO to search the directory
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://dc=directory,dc=upenn,dc=edu,ou=people,o=upenn.edu>"
' This controls which records we want to return from LDAP
strFilter = "(sn=ESPE*)"
' This controls the fields returned for the records
strAttributes = "sn"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 1024
objCommand.Properties("Timeout") = 120
objCommand.Properties("Cache Results") = False
wscript.echo "Retrieving records"
Set objRecordSet = objCommand.Execute
<<<<--- HERE IS WHERE IT PAUSES FOR SEVERAL SECOND THEN GIVES THE TABLE
ERROR
Thanks,
Grant Schenck
.
- Follow-Ups:
- Re: LDP ADO Equivalence
- From: Grant Schenck
- Re: LDP ADO Equivalence
- Prev by Date: Automatically running an application every day
- Next by Date: Re: Inherit ado method
- Previous by thread: Automatically running an application every day
- Next by thread: Re: LDP ADO Equivalence
- Index(es):
Relevant Pages
|
|