Hope I've posted this in the right area and that you can help me
Hi
I'm trying to extract data from an LDAP database.
I can connect fine, and pull some information using this code:
Code:
Set ado = CreateObject("ADODB.Connection")
ado.Provider = "ADSDSOObject"
ado.Properties("User ID") = "username"
ado.Properties("Password") = "password"
ado.Properties("Encrypt Password") = False
ado.Open "ADS-Anon-Search"
serverName = "10.10.10.1/cn=Units"
filterStr = "(&(objectclass=unit)(serialnumber=*123456*))"
Set objectList = ado.Execute("<LDAP://" & serverName & ">;" & filterStr & ";ADsPath;SubTree")
While Not objectList.EOF
WScript.Echo objectList.Fields(0).Value
objectList.MoveNext
Wend
The above returns a list of all live units which match the serial number.
What I can't seem to do is get any further information from the LDAP 'UNIT \cn=Units'
I know each Unit in cn=Units, also has:
ipaddress
cn
name
id
location
password
status
I have tried to edit ";ADsPath;SubTree" to ";ADsPath,name, id,location;SubTree"
But this returns an error..
I have used PHP to get this information, so I know it's there..
So how do I get it using VBS ??
Thanks for your time.