Solved

LDAP Query OR statement

Posted on 2008-06-26
3
4,589 Views
Last Modified: 2012-06-21
I'm hoping this is a very easy question. I've tried looking through existing Q&As but couldn't find anything similar. I'm trying to develop a Search Query in ADUC. What I need is a list of active users that have an office location populated with one of the mulitple options I give. So, the list will show me Jon in office 5, Joe in office 8, etc.

Here's what I have -
(&(&(objectCategory=user)(physicalDeliveryOfficeName=5)(objectCategory=user)(physicalDeliveryOfficeName=8)(&(&(objectCategory=user)(!userAccountControl:1.2.840.113556.1.4.803:=2)))))

Any help or direction will be greatly appreciated.
thanks.
0
Comment
Question by:DESIGNUTT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
LauraEHunterMVP earned 125 total points
ID: 21875365
To start with, unless you have indexed objectClass, you need to search on "(&(objectcategory=Person)(objectClass=User))

If I'm understanding you correctly, you want to craft the following query:

Show me users who are not disabled AND who are in office locations 3 OR 4 OR 5 OR...

I don't have a testbed in front of me right now, but it'll be something similar to the following:

"(&(objectcategory=person)(objectclass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2)(|(physicalDeliveryOfficeName=5)(physicalDeliveryOfficeName=8)))"
0
 

Author Comment

by:DESIGNUTT
ID: 21875532
I tried what you posted. I get an error "not a valid string". I tried to add using Custom Search by field user contains 8. That's how I got the string that I originally posted.

I will keep trying to tweak. Any other info would be helpful too.
thanks.
0
 

Author Comment

by:DESIGNUTT
ID: 21875898
I got it! Something was strange on my existing query. I created a new one from scratch, and that seemed to work! Thanks for your prompt response.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question