LDP ADO Equivalence



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:
Dn:
2> objectClass: top; OpenLDAProotDSE;
-----------
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:
Dn: uid=despey,ou=people,o=upenn.edu
1> sn: ESPEY;
Dn: uid=staceye,ou=people,o=upenn.edu
1> sn: ESPENLAUB;
Dn: uid=espeletj,ou=people,o=upenn.edu
1> sn: ESPELETA JR;

---------------------------------------------------------------------

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


.



Relevant Pages

  • Re: get ProxyAddresses from any user in AD
    ... I think I like the ADO ... > the displayName attribute exposed by the LDAP provider. ... > ' Constants for the NameTranslate object. ... you could retrieve this from the WshNetwork object. ...
    (microsoft.public.scripting.vbscript)
  • Re: ADSI and NDS help
    ... Microsoft MVP Scripting and ADSI ... trying to locate a user object in eDirectory via LDAP using ADSI. ... Sometimes you get a type mismatch error when ADO returns a null value (in ...
    (microsoft.public.scripting.vbscript)
  • Re: msDS-KeyVersionNumber AD property
    ... It doesn't look like LDAP provides access to the msDS-KeyVersionNumber ... and pasted the code into my script but it still reports a blank value. ... 'Setup ADO ...
    (microsoft.public.scripting.vbscript)
  • Re: How to bind to user object without knowing the path
    ... than using ADO. ... Below is a function that will take a samaccountname as input ... and return the distinguishedname that you then can bind with LDAP. ... I want to bind to a user object using ...
    (microsoft.public.windows.server.scripting)
  • Re: ADAM on Win XP Pro 2002 SP2 without AD
    ... LDP is a bit of rocket science to use... ... Its a free gui LDAP Administrator ... Joe Kaplan wrote: ... Ldp.exe is much lower level than ADSI Edit, so there is more of a learning ...
    (microsoft.public.windows.server.active_directory)