Irrylyn
asked on
LDAP Query for Display Name OR Description
Hello all!
So I'm looking for an LDAP query for Active Directory that will match the following requirements:
Is a User
AND has *COL* in the Display Name
OR has *BG* in the Display Name
OR has *Director* in the Office field
AND does NOT have *Directorate* in the Office field
I've gotten the first part to work with:
(&(objectcategory=person)( objectclas s=user))(| (displayNa me=*COL *)(displayName=*BG *)(physicaldeliveryofficen ame=*direc tor*))
But when I run this, it also includes anything with the word "Directorate" which I dont want. So I tried to add "does NOT include "directorate" and I get no results:
(&(objectcategory=person)( objectclas s=user))(| (displayNa me=*COL *)(displayName=*BG *)(physicaldeliveryofficen ame=*direc tor*))(&(p hysicaldel iveryoffic ename!=*di rectorate* ))
If I move the != around like so, I get the same info as before which includes "directorate":
(&(objectcategory=person)( objectclas s=user))(| (displayNa me=*COL *)(displayName=*BG *)(physicaldeliveryofficen ame=*direc tor*)(phys icaldelive ryofficena me!=*direc torate*))
What am I doing wrong?
So I'm looking for an LDAP query for Active Directory that will match the following requirements:
Is a User
AND has *COL* in the Display Name
OR has *BG* in the Display Name
OR has *Director* in the Office field
AND does NOT have *Directorate* in the Office field
I've gotten the first part to work with:
(&(objectcategory=person)(
But when I run this, it also includes anything with the word "Directorate" which I dont want. So I tried to add "does NOT include "directorate" and I get no results:
(&(objectcategory=person)(
If I move the != around like so, I get the same info as before which includes "directorate":
(&(objectcategory=person)(
What am I doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, spam... thinking about it there's another way to read the statement above. This time based on this interpretation:
Is a User
AND (has *COL* in the Display Name
OR has *BG* in the Display Name
OR (has *Director* in the Office field
AND does NOT have *Directorate* in the Office field))
Anyway, I hope that helps :)
Chris
Is a User
AND (has *COL* in the Display Name
OR has *BG* in the Display Name
OR (has *Director* in the Office field
AND does NOT have *Directorate* in the Office field))
(&(objectClass=user)(objectCategory=person)(|(displayName=*col*)(displayName=*BG*)(&(physicalDeliveryOfficeName=*Director*)(!physicalDeliveryOfficeName=*Directorate*))))
Anyway, I hope that helps :)
Chris
ASKER
Aha! Okay, I see. I was close but I see better now how the ! works. Thank you very much.
Both of your queries worked and gave the same results. Very good information!
Both of your queries worked and gave the same results. Very good information!
ASKER
Very good tutelage. The queries provided worked well and there was even a 'just in case' alternative.
Great job and thank you!
Great job and thank you!
Open in new window
Chris