Solved

LDAP Query OR statement

Posted on 2008-06-26
3
4,504 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 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Suggested Solutions

Installing a printer using group policy preferences is not that hard let’s take a look at it. First lets open up your group policy console and edit the policy you want to add it to. I recommend creating a new policy for each printer makes it a l…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now