ldap - VBScript returning 0 rows when ADSIEdit returns correct number of rows -
i've been banging head against last 2 days or so, , without success - regardless try. when run query retrieve share volumes ends specific ending, work in adsiedit - not in vbscript. odd, i'm using same query.
the adsiedit query configured so:
- name: test
- root of search: dc=ad,dc=server,dc=com
- query string: (&(objectcategory=volume)(objectclass=volume)(cn=k_*))
query scope: subtree search.
- search results: 11 records cn starts k_
- vbscript results: 1 record (!?!?)
if change query string (last part) (uncname=*\5cost-gro)) instead, want (the first query string gave testing purposes), in adsiedit 7 rows returned - in vbscript none!
here's (current) vbscript code:
set objdomain = getobject("ldap://rootdse") set objsysinfo = createobject("adsysteminfo") set objconnection = createobject("adodb.connection") objconnection.provider = "adsdsoobject" objconnection.open "active directory provider" set objcommand = createobject("adodb.command") set objcommand.activeconnection = objconnection strdnsdomain = objdomain.get("defaultnamingcontext") objcommand.commandtext = "select name, uncname, managedby "_ & "'ldap://dc=ad,dc=server,dc=com'" _ & " objectclass='volume' , uncname = '*\5cost-gro'" 'the below not working either! 'objcommand.commandtext = "<ldap://dc=ad,dc=server,dc=com>;"_ ' & "(&(objectcategory=volume)(objectclass=volume)(uncname=*\5cost-gro));"_ ' & "name,uncname;subtree" set objrecordset = objcommand.execute( , , adcmdtabledirect) avargetrowsarray = objrecordset.getrows(intnumrows, bkmrk) ' returns 0 objrecordset.movefirst ' doesn't if objrecordset.supports(adapproxposition)=true nrrecords=objrecordset.recordcount end if if not objrecordset.eof while not objrecordset.eof msgbox "match found! " & objrecordset.fields("name").value, vbokonly, "match found" objrecordset.movenext loop else msgbox "no matches found. " & ubound(avargetrowsarray), vbokonly, "no matches!" end if
hoping can help. i've read countless topics on failed each , every 1 :(
edit: i've think i've nailed down trust/permission issue. when run adfind (or dsquery) on ad machine, returns correct number of rows. however, if run on client machine, returns wrong amount of rows. question is, how do solve it?
server:
d:\tests>adfind -c -f "(&(objectcategory=volume)(objectclass=volume)(uncname=*\5 cost-gro))" adfind v01.45.00cpp joe richards (joe@joeware.net) march 2011 using server: ad.server.com:389 directory: windows server 2003 base dn: dc=ad,dc=server,dc=com 7 objects returned d:\tests>
client:
c:\tests>adfind -c -f "(&(objectcategory=volume)(objectclass=volume)(uncname=*\5 cost-gro))" adfind v01.45.00cpp joe richards (joe@joeware.net) march 2011 using server: ad.server.com:389 directory: windows server 2003 base dn: dc= dc=ad,dc=server,dc=com 0 objects returned c:\tests>adfind -c -f "(&(objectcategory=volume)(objectclass=volume)(cn=k_*))" adfind v01.45.00cpp joe richards (joe@joeware.net) march 2011 using server: ad.server.com:389 directory: windows server 2003 base dn: dc= dc=ad,dc=server,dc=com 1 objects returned
@exodus: escaping sign error. have use "\5c" (upper case) if want search backslash. hier link more details: http://www.rlmueller.net/charactersescaped.htm
Comments
Post a Comment