[Date Prev][Date Next] [Chronological] [Thread] [Top]

How to access OpenLDAP using VBScript



I could not find this anywhere on the Internet, so I am posting it to this
list so someone else may find it useful in the future.

How to Access OpenLDAP using VBScript
---------------------------------------------

Dim oConn,oRS,vSearch,vCount,vMailList,vValue,vProblem,vMsg

' Set the vStatus flag to True...
vProblem = False

' Build the LDAP search condition...
vSearch = "(sn=Leeds)"

' Instantiate the connection and log in to OpenLDAP
Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADsDSOObject"
oConn.Open "ADs Provider", "cn=mail_verify,ou=accounts,dc=mckee,dc=com",
"mypassword"

' Execute the search...
Set oRS = oConn.Execute("<LDAP://leconte/dc=com/dc=mckee>;" & vSearch &_
";cn,mail")

' Create an array of returned values
vCount = 1
While not oRS.EOF

   For Each vValue in oRS.Fields(0).value
      WScript.Echo vValue
   Next

vCount = vCount + 1
oRS.MoveNext
Wend

http://shell.cdc.net/~lds0062/reference/vbscript_to_ldap.htm