Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Running custom LDAP query in AD

Posted on 2011-02-23
4
Medium Priority
?
763 Views
Last Modified: 2013-12-24
Hi

We're running AD 2008 with 2008 Server member servers too. For some users we have a custom application that sets special AD attributes, these attributes are named

"customSync" - possible values YES, NO, SP1
"customEmail" - possible values PARTNER, SMTP1, SMTP2

What I'd like to do is run a query in AD to find users with some of these values, as below:

1. customSync=SP1
2. customEmail = SMTP1
3. customSync=YES *and* customEmail=SMTP2
4. customSync=YES *or& customEmail=SMTP2

I'd like to use ADUC to do this. I guess I can create a query within there, but after that I'm lost? All I can see is how to set queries for existing attributes (e.g. display name).

Could someone advise? I guess I need to run some sort of Custom Query but am not sure of which one and also the syntax to use for the four situations above.


0
Comment
Question by:kam_uk
[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
  • 3
4 Comments
 
LVL 27

Accepted Solution

by:
KenMcF earned 2000 total points
ID: 34964435
You would need to create a custum Query. Do this by selecting new query and when you define the query select Custom search from the drop down.

the query should be

(&(objectcategory=person)(objectclass=user)(customSync=SP1))

(&(objectcategory=person)(objectclass=user)(customEMail=SMTP1))

(&(objectcategory=person)(objectclass=user)(customSync=YES)(customEMail=SMTP2))

(&(objectcategory=person)(objectclass=user)(|(customSync=YES)(customEMail=SMTP2)))
0
 
LVL 27

Expert Comment

by:KenMcF
ID: 34964461
Also here is a link that explains the queries

http://technet.microsoft.com/en-us/library/aa996205(EXCHG.65).aspx
0
 
LVL 3

Author Comment

by:kam_uk
ID: 34964488
Thanks!

And, instead of users only, I just wanted all objects returned for those results I wanted, would it be:

1. (customSync=SP1)
2. (customEMail=SMTP1)
3. (&(customSync=YES)(customEMail=SMTP2))
4. ??

or for #1, #2 can I omit the brackets? [the link you gave me does always have brackets though)
0
 
LVL 27

Expert Comment

by:KenMcF
ID: 34964535
Depending on how many objects you have in your AD these will not be effecient searches becuase I am assuming these attributes are not indexed. You could run them as you have listed but understand this could put some overhead on your DC when running the query.
1 & 2 need to have the ()
4 wound be
(|(customSync=YES)(customEMail=SMTP2))
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Let's recap what we learned from yesterday's Skyport Systems webinar.
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

610 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