Tom_T Posted November 3, 2010 Share Posted November 3, 2010 HiI'm trying to extract data from an LDAP database.I can connect fine, and pull some information using this code: Set ado = CreateObject("ADODB.Connection")ado.Provider = "ADSDSOObject"ado.Properties("User ID") = "username"ado.Properties("Password") = "password"ado.Properties("Encrypt Password") = Falseado.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.MoveNextWend 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:ipaddresscnnameidlocationpasswordstatusI 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. Link to comment Share on other sites More sharing options...
Tom_T Posted November 3, 2010 Author Share Posted November 3, 2010 Quick update. Changing to this allows me to pull some more information. Set objectList = ado.Execute("<LDAP://" & serverName & ">;" & filterStr & ";cn,description,objectclass,telephonenumber", ADS_SECURE_AUTHENTICATION + ADS_SERVER_BIND) BUT as soon as I try to get anything else I get errors.eg: ";cn,id,description,objectclass,telephonenumber" Anyone any ideas ? As mentioned PHP works fine ! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.