Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - problem with ldap query again exchange fields

Reply
 
Old 08-03-2008   #1 (permalink)
Dan Lewis


 
 

problem with ldap query again exchange fields

I'm trying to query two specific AD user exchange properties (in ldp,
I can query them as o (which should be the 'office' of the user)) and
extensionattribute2. With my script, I can query other values with no
problem, but these two are causing errors:

strBase = "<LDAP://ou=users,ou=xxx,dc=yyy,dc=zzz>"
strFilter = "(&(objectCategory=person)(objectClass=user))"**
strAttributes = "sAMAccountName,cn,Extension-Attribute-2,o"
strQuery = strBase & ";" & strFilter & ";" & strAttributes &
";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
*
Do Until objRecordSet.EOF*
* strName = objRecordSet.Fields("sAMAccountName").Value
* strName = strName & "," &
objRecordSet.Fields("userprincipalName").Value
* strCN = objRecordSet.Fields("cn").value
* strCreated = objRecordSet.Fields("whenCreated").value
*
* wscript.echo objRecordSet.Fields("Extension-Attribute-2") & ", " &
objRecordSet.Fields("o")
* objRecordSet.MoveNext
Loop
objConnection.Close

Any help is appreciated.



My System SpecsSystem Spec
Old 08-04-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: problem with ldap query again exchange fields

Dan Lewis

I'm trying to query two specific AD user exchange properties (in ldp,
I can query them as o (which should be the 'office' of the user)) and
extensionattribute2. With my script, I can query other values with no
problem, but these two are causing errors:

strBase = "<LDAP://ou=users,ou=xxx,dc=yyy,dc=zzz>"
strFilter = "(&(objectCategory=person)(objectClass=user))"
strAttributes = "sAMAccountName,cn,Extension-Attribute-2,o"
strQuery = strBase & ";" & strFilter & ";" & strAttributes &
";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute

Do Until objRecordSet.EOF
strName = objRecordSet.Fields("sAMAccountName").Value
strName = strName & "," &
objRecordSet.Fields("userprincipalName").Value
strCN = objRecordSet.Fields("cn").value
strCreated = objRecordSet.Fields("whenCreated").value

wscript.echo objRecordSet.Fields("Extension-Attribute-2") & ", " &
objRecordSet.Fields("o")
objRecordSet.MoveNext
Loop
objConnection.Close

Any help is appreciated.

-----
Use the LDAPDisplayName of the attribute, which is "extensionAttribute2".

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
working LDAP query, well almost.. 800A000D VB Script
Query LDAP to get user Telephone VB Script
How can I query LDAP in WLM? Live Mail
LDAP Problem when query AD on Windows 2000 with Exchange 5.5 PowerShell
help with LDAP query PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46