ldapldap-query

Ldap filter not working for filtering out OU


I am looking to filter out an OU. For example, I would like to filter out OU=Designers OU=Designers,OU=Employees,DC=company,DC=com

I am using this ldap filter, (&(objectCategory=person)(objectClass=user)(!(distinguishedName=CN=*,OU=Designers,OU=Employees,DC=company,DC=com)))

This is not working. Is there something I am missing here?

I tried an ldap filter but it is not working. I am looking to filter out an OU. Used this as reference - https://learn.microsoft.com/en-us/windows/win32/adsi/search-filter-syntax


Solution

  • (&(objectClass=User)(objectcategory=person)(!(|(msDS-parentdistname=OU=Designers,OU=Employees,DC=company,DC=com))))

    this worked.