Using VBScript to access data on LDAP



To the best of my knowledge I'm trying to retrieve data from an iPlanet LDAP
Server. I want to create a user-friendly interface that will allow us to
update the data stored in the LDAP server. Most of the programming I've been
doing has been against Windows 2003 AD, and I seem to be able to connect to
the server, but nothing is getting returned, rather nothing USEFUL is coming
back.

I ran a query against the LDAP server to return the CN of all objects that
are owned by me, which is 3. I receive 3 hits but it returns null, I believe
the code is fairly straightforward I based it off the code listed here:

http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0412.mspx

Here is my version of that code:

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = "me"
objConnection.Properties("Password") = "password"

objConnection.Open "LDAP Provider"

Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection

objCommand.CommandText = "SELECT name FROM
'LDAP://server:389/ou=devices,ou=network,dc=sample,dc=local' WHERE
owner='uid=me"
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields.item("name").value
count = count + 1
objRecordSet.MoveNext
Loop

wscript.echo count

This code when run against the LDAP server returns the following output:

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

null
null
null
3

I copied this code into Visual Basic 2005 Express Edition and modified to
store the data in a listbox, I did this mainly to see what was returned from
the query. As I stepped through the running code I received no errors, but
when I attempted to view what was stored in the objRecordset object it told
me 'Children could not be evaluated'. Yet it returns the correct number of
objects each time, just as null's.

Second when I attempt to use actualy attributes such as CN, OU, DN things of
that nature I get a type mismatch error like the following:

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Users\jeffpatton\Desktop\AD Migration Scripts\list2.vbs(16, 5) Microsoft
VBSc
ript runtime error: Type mismatch

At one point I thought I was connecting to the objects but was getting back
a collection so I attempted to query for everything but only display the
field I wanted such as CN, this yieds the following error:

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Users\jeffpatton\Desktop\AD Migration Scripts\list2.vbs(16, 5)
ADODB.Fields:
Item cannot be found in the collection corresponding to the requested name
or or
dinal.

I feel that I should be getting back at least the CN or OU but nothing
appears to work and it's been very frustrating. I have googled vbscript and
iplanet and basically get back a list of resumes, which does nothing for me.

If there is anyone who has some experience in working with non-ms LDAP and
vbScript that would be so helpful to me.

Thank you for your time and attention,

Jeff
.



Relevant Pages

  • Re: Configuring LDAP on Entourage 2004 OS X
    ... On the SBS server box, open Server Management console, navigate to ... by companies that are independent of Microsoft. ... Configuring LDAP on Entourage 2004 OS X ...
    (microsoft.public.windows.server.sbs)
  • Re: Gruppenmitglieder in eine Textdatei exportieren
    ... brauchst den LDAP-Objektpfad an vielen Stellen im AD. ... Zweitens ist der LDAP-Pfad keine Erfindung von Microsoft, ... habt Ihr einen super SQL Server, dann portiert das doch auf den Server ... LDAP hat mit der darunter liegenden Datenbank nicht das geringste zu tun, ...
    (microsoft.public.de.german.win2000.active_directory)
  • RE: DC migrated from NT4 to 2003: cannot LDAP top level search dc=
    ... You can use a Microsoft Support Tool LDP.exe to test if can query the AD ... | Thread-Topic: DC migrated from NT4 to 2003: cannot LDAP top level search ... | Server 'Forest' ist the master ...
    (microsoft.public.windows.server.migration)
  • Re: Gruppenmitglieder in eine Textdatei exportieren
    ... Super Argumentation. ... Erstens arbeite ich nicht bei Microsoft, ... habt Ihr einen super SQL Server, dann portiert das doch auf den Server und die Sache ist vom Tisch. ... LDAP hat mit der darunter liegenden Datenbank nicht das geringste zu tun, ...
    (microsoft.public.de.german.win2000.active_directory)
  • SecurityFocus Microsoft Newsletter #49
    ... Subject: SecurityFocus Microsoft Newsletter #49 ... Microsoft Windows NNTP Denial of Service Vulnerability ... Microsoft IIS SSI Buffer Overrun Privelege Elevation Vulnerability ... Microsoft ISA Server H.323 Memory Leak Denial of Service... ...
    (Focus-Microsoft)

Quantcast