LDAP Import - How to exclude sub ou?

Kifrez
Kilo Guru

Hi All,

We have starting search directory OU=Users,OU=CompanyA,DC=abc,DC=com, DC=au

We have sub OU called contractors (OU=Contractors) so in AD, it will be OU=Contractors,OU=Users,OU=CompanyA,DC=abc,DC=com, DC=au

How do I exclude OU=Contractors?

I have LDAP OU Definition 
Query field = sAMAccountName
Filter = (&(objectClass=person)(sn=*)(!(objectClass=computer)) (!(userAccountControl:1.2.840.113556.1.4.803:=2)))

I've tried to add (!(OU=Contractors)), but this doesn't seem to exclude when I browse or do test load.
Modified filter = (&(objectClass=person)(sn=*)(!(objectClass=computer)) (!(OU=Contractors)) (!(userAccountControl:1.2.840.113556.1.4.803:=2)))

Thank you in advanced for your assistance.

 

1 ACCEPTED SOLUTION

Kifrez
Kilo Guru

ServiceNow said this is not possible to filter by OU after the searchbase is defined.

If want to be excluded under the searchbase, requires an exclusion using Attributes.

For example:

If you would like to exclude employeeType=Contractor, then use the following filter.

(&(objectClass=person)(sn=*)(!(objectClass=computer)) (!(employeeType=Contractor))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))

 

View solution in original post

5 REPLIES 5

Kifrez
Kilo Guru

ServiceNow said this is not possible to filter by OU after the searchbase is defined.

If want to be excluded under the searchbase, requires an exclusion using Attributes.

For example:

If you would like to exclude employeeType=Contractor, then use the following filter.

(&(objectClass=person)(sn=*)(!(objectClass=computer)) (!(employeeType=Contractor))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))