Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

LDAP Query OR statement

Posted on 2008-06-26
3
Medium Priority
?
4,664 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
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
LauraEHunterMVP earned 500 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

886 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