Re: LDAP query help request.
- From: "David Gibbons" <FreRange@xxxxxxxxxxxxxxxx>
- Date: Tue, 29 Aug 2006 09:21:11 -0700
Richard...
You rock! I also see where I was making my coding mistakes. Wow this
syntax is a bit odd to work with.
I think the mistake I was making in most of my attempts was understanding
the joining of the query.
Again, thank you very much Richard...
David.
"Richard Mueller" <rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23xBcDMwyGHA.4976@xxxxxxxxxxxxxxxxxxxxxxx
David Gibbons wrote:
I'm trying to create some LDAP queries and seem to be running into a
syntax problem.
(&(objectCategory=user)(|(department=*60)(department=*61))(&(|(department=0042*)(department=0043*))))
The above statement works however I'm trying to add one more filter to
the statement and nothing I do seems to work. The idea is as follows...
(employeeid=1111) or (((Department=*60) or (Department=*61)) and
((Department=0042*) or (Department=0043*)))
This would return all the results for the 4 department number
combinations plus the 1 user with the employee id or 1111.
I thought that this statement would work... (as well as many many many
different syntax changes and I think this is the last one I tried before
hitting the newsgroups.)
(&(objectCategory=user)(|(employeeid=1111))(|(department=*60)(department=*61))(&(|(department=0042*)(department=0043*)))(!userAccountControl:1.2.840.113556.1.4.803:=2))
But it return no results, just one user, every user in AD or is invalid
depending on the syntax change. I could do this is SQL but for some
reason I just can't seem to get the syntax correct in LDAP.
Anyone of there see what it is I'm doing wrong or could lead me to better
LDAP syntax example pages then the one I have found?
Hi,
If I understand correctly, I would try:
(&(objectCategory=user)(!userAccountControl:1.2.840.113556.1.4.803:=2)(|(employeeid=1111)(&(|(department=*60)(department=*61))(|(department=0042*)(department=0043*)))))
This assumes you want:
((department=*60) Or (department=*61)) And ((department=0042*) Or
(department=0043*))
so departments 004260, 004261, 004360, and 004361 would satisfy the query
(among others).
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
.
- Follow-Ups:
- Re: LDAP query help request.
- From: Paul Williams [MVP]
- Re: LDAP query help request.
- References:
- LDAP query help request.
- From: David Gibbons
- Re: LDAP query help request.
- From: Richard Mueller
- LDAP query help request.
- Prev by Date: weighted DC preferences for user login *within* a site?
- Next by Date: Re: AD Site Criteria and DFS
- Previous by thread: Re: LDAP query help request.
- Next by thread: Re: LDAP query help request.
- Index(es):
Relevant Pages
|