![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
![]() |
| 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 | |||