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:
Code:

!(!employeeID=*))(!(|(employeeID=Contractor)(employeeID=Vendor)(employeeID=<*)(sAMAccountName=a-*)(sAMAccountName=SB-*))

When I click ok To this i Get:
Code:

(&(|(objectClass=user))(!(!employeeID=*))(!(|(employeeID=Contractor)(employeeID=Vendor)(employeeID=<*)(sAMAccountName=a-*)(sAMAccountName=SB-*))))

This Works Perfectly…

Heres the problem:

I also Need to EXCLUDE in the above Filter:

OU=FireFighters,OU=Users,DC=COMPANY,DC=COM

Ive done every varient you could think of…

!(|(OU=FireFighters))
(!OU=FireFIghters)
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:

(|(objectClass=user))(!(!employeeID=*))

is equivalent to

(objectClass=user)(employeeID=*) 

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

This section of the filter

(!(|(employeeID=Contractor)(employeeID=Vendor)(employeeID=<)(sAMAccountName=a-*)(sAMAccountName=SB-*))))

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

(&(objectClass=user)(!(|(employeeID=Contractor)(employeeID=Vendor)(employeeID=<)(sAMAccountName=a-*)(sAMAccountName=SB-*)(cn=FireFighters)))

Here is a decent article on writing filters

(!(!employeeID=*))

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.

(&(|(objectClass=user))(!(!employeeID=*))(!(|(employeeID=Contractor)(employeeID=Vendor)(employeeID=<*)(sAMAccountName=a-*)(cn=FireFighters))))

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

Perhaps

(&(objectClass=user)(!(cn=FireFighters))(employeeID=*)(!(|(employeeID=Contractor)(employeeID=Vendor)(employeeID=<)(sAMAccountName=a-*)(sAMAccountName=SB-*))))
(&(|(objectClass=user))(!(cn=FireFighters))(employeeID=*)(!(|(employeeID=Contractor)(employeeID=Vendor)(employeeID=<)(sAMAccountName=a-*)(sAMAccountName=SB-*))))

Still bought in FireFighters

Perhaps something a little more verbose

(!(memberOf=cn=FireFighters,ou=Users,dc=COMPANY,dc=COM))

did that also