LDAP Search Function to IGNORE an OU

Hello all.
I have been pulling my hair on this and I have done every trigger i could think of and it still isnt working…

I have a BASE DN of: OU=Users, DC=COMPANY, DC=COM
I have an ObjectClass of User
and My search Filter code looks like:


When I click ok To this i Get:


This Works Perfectly…

Heres the problem:

I also Need to EXCLUDE in the above Filter:


Ive done every varient you could think of…

etc, etc

Any Help with Placement to exclude these guys would be a GREAT HELP, this is my first time doing this, so please bear with me.!!

Thank you so much in advance!

I think your filter is more complicated than it needs to be.

This section of the filter:


is equivalent to


which is saying include all users who have an employeeID, which I am guessing is pretty much everyone.

This section of the filter


Is saying:

NOT (employeeID=Contractor or employeeID=Vendor or employeeID=< or sAMAccountName=a-* or sAMAccountName=SB-*)

So in other words, only select users where none of those things are true.

So perhaps


Here is a decent article on writing filters


is there to IGNORE people that have an Employee Record as NULL

I did the (!employeeID=*) but didnt work…but the one above worked…

I am Running your code to test right now, and it still bought in the FireFighters.


The equivalent to this would be (employeeID=*) the two invertions ! cancel out.



Still bought in FireFighters

Perhaps something a little more verbose


did that also