ldap - Why does VBScript fail with a “Type mismatch" error? -
i experiencing difficulty following vbs
set conn = createobject("adodb.connection") conn.provider = "adsdsoobject" conn.open "ads provider" strquerydl = "<ldap://company.address.com/cn=address>;(&(objectcategory=person)(objectclass=user));distinguishedname,adspath;subtree" set objcmd = createobject("adodb.command") objcmd.activeconnection = conn objcmd.properties("searchscope") = 2 ' want search objcmd.properties("page size") = 500 ' , want our records in lots of 500 objcmd.commandtext = strquerydl set objrs = objcmd.execute while not objrs.eof wscript.echo objrs.fields("distinguishedname") ' objrs.fields("distinguishedname")' objrs.movenext wend
please me, started vbscripting , answer in website.
wscript.echo objrs.fields("distinguishedname")
the error above line/code. how display out field or convert display?
ldap://company.address.com/cn=address
not valid ldap url (see here). search base must distinguished name, e.g.:
ldap://company.address.com/cn=address,dc=address,dc=com
the distinguished name of domain (dc=address,dc=com
) can obtained this:
set rootdse = getobject("ldap://rootdse") wscript.echo rootdse.get("defaultnamingcontext")
Comments
Post a Comment