How can I write an ldap query to include all users from my active directory except those in a certain OU?
Posted on 2011-10-28
I'm having a debate with myself. I'm just starting to understand LDAP Queries and wanted to pose a couple of questions because I can't seem to find the right information anywhere.
I get I can write an LDAP query that starts at the root of my Active Directory and return all the users in my AD environment.
Now..what if I want to traverse my directory and say give me all users in my Active Directory environment EXCEPT for the users in OU=Test,DC=somecity,DC=company,DC=com?
isn't working. That returns all users regardless of their OU affiliation.
Am I using the & operator incorrectly? I also tried (what I thought was): give me all the users in the given OU...that didn't work either?
Any suggestions or assistance will be greatly apprciated!