Reputation: 1401
I want to search in the AD with LDAP, with a condition that people are not in a specific OU (see example)
Domain.local
- [OU] Location A
-- [OU] Users
-- [OU] Computers
- [OU] Location B
-- [OU] Users
-- [OU] Computers
- [OU] Location C
-- [OU] Users
-- [OU] Computers
In my filter I want all users BUT the users from Location B/Users
is this possible? And if yes, how?
Upvotes: 2
Views: 1807
Reputation: 72630
ExtensibleMatch explained here allow to build filters on the DN path, but it's not supported in Active Directory. As far as I know you've got the following solution to do what you want:
OU
which is inherited from organizationalPerson
class. you set it with "locationB" (it's multivaluated)The third solution is the one I use. My advice in your case is :
Test if OU attribute is used in your Directory for users or inetorgpersons if so select an other attribute
(&(|(objectclass=inetOrgPerson)(objectclass=user))(ou=*))
by scripting, by programming,by using LDIF populate the attribute you choose and keep it in use
If you are programmin with C# you've got the information of "parent" for an object as I explain in a simalary question so you can sort object on this criterium.
Upvotes: 4