How to query a non-Windows LDAP server using ADSI and vbscript 
Author Message
 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 -----------------------



Wed, 16 Nov 2005 02:53:57 GMT  
 How to query a non-Windows LDAP server using ADSI and vbscript
all the DN's in a particular OU?  What do you mean?  Am I reading this wrong
(I am sick with a cold so might)?


Quote:
> 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 -----------------------



Wed, 16 Nov 2005 04:45:26 GMT  
 How to query a non-Windows LDAP server using ADSI and vbscript
Yes, I want to query all the DNs in an OU.  You're reading this correctly.

Am I using the correct provider?


Quote:
> all the DN's in a particular OU?  What do you mean?  Am I reading this
wrong
> (I am sick with a cold so might)?



> > 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 -----------------------



Thu, 17 Nov 2005 05:52:34 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using VB to access Exchange Server via ADSI/LDAP

2. Using VB to access Exchange Server via ADSI/LDAP

3. LDAP Authentication Example Using VBScript (non-.NET)

4. Trying to query Exchange 5.5 LDAP provider using VBScript

5. Query an Exchange Server using ADSI

6. LDAP field values from 3rdparty Directory using ADSI and VB

7. LDAP field values from 3rdparty Directory using ADSI and VB

8. LDAP search using ADSI sdk for VB

9. PRB: Executing a non-row returning query on the server using ADO

10. PRB: Executing a non-row returning query on the server using ADO

11. Has anyone successfully connected to an LDAP directory using ADSI

12. Error connecting to AD using ADSI and LDAP on NT4

 

 
Powered by phpBB® Forum Software