Exclude sub OUs in LDAP

Pintu2
Tera Expert

How to exclude a sub-OU in importing an OU into ServiceNow?

I have an OU ABC with few sub-OUs and I don't want one of the sub-OUs in ServiceNow.How to exclude the users from one the sub-OU and if not how could I not update/insert these users in ServiceNow?

Appreciate your response.

 

Thank you.

8 REPLIES 8

Allen Andreas
Administrator
Administrator

Hi,

You can set your RDN in your LDAP OU Definition to the specific OU that you want to pull-in and to avoid any specific OUs within...in the filter you can do something like:

(!(ou=ServiceAccounts))

So this would filter out the ou that is called ServiceAccounts.

See: https://docs.servicenow.com/integrate/ldap/task/t_DefineLDAPOrganizationalUnits.html for full filter example that you'd want to start with and then add mine in...where you see the (!( piece.

Please mark reply as Helpful/Correct. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I tried giving the same filter as mentioned but it didn't work for me. Please see below and can you suggest any other alternate way to do this

 

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

 

The same way I tried giving the filter as per my OU definitions but it didn't work

Hi,

Did you replace ServiceAccounts with the actual name of the OU? Can you just try:

(&(objectClass=person)(sn=*)(!(objectClass=computer))(!(ou=ServiceAccounts)))

You should be able to click Browse after saving here to then try and see if the user/OU still shows up or not:

find_real_file.png

So this way you can test faster to see if the filter is working or not.

This should work as I have posted it.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Yes, I did replace with the actual name of my sub-OU but it's not working. Not sure why it is not working in case of a sub-OU.But when I tried filtering with other fields like the (!(description=compliance*)) then it is able to exclude the sub-OU with the description filter.