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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Your exclusion looks fine

(&(objectClass=person)(sn=*)(!(objectClass=computer)) (!(OU=Contractors)) (!(userAccountControl:1.2.840.113556.1.4.803:=2)))

Try to load the data actually and not to check with Browse. Possibly the Browse link doesn't respect the filter

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, that doesn't work either. I will submit Hi ticket. Thanks for confirming 🙂

palanikumar
Mega Sage

Hi,

Normally we use OU filter in lower case. Can you try your as below:

(&(objectClass=person)(sn=*)(!(objectClass=computer)) (!(ou=Contractors)) (!(userAccountControl:1.2.840.113556.1.4.803:=2)))

Also make sure the value Contractor is in correct case. 

Thank you,

Palani

Thank you,
Palani

Hi Palani, I've tried that few hours ago, unfortunately, it doesn't work either. I will submit Hi ticket. Thanks for confirming.