Problem
You want to perform an LDAP search, matching entries which do not match certain criteria.
Solution
To perform a logical NOT we just use the exclamation mark ! – see example.
Example
This is how to perform a logical OR LDAP search.
ldapsearch -x -v-D"cn=Manager,dc=demo,dc=net"-w secret
-b"dc=demo,dc=net" "(!(sn=Doe))"
Reference
[tags]ldapsearch syntax, openldap ldapsearch, LDAP Training School[/tags]