Q:

LDAP Python - Search for users which are members of a group in nested OUs

I am trying the search command below in Python using the LDAP library with no luck.
conn.search('dc=int,dc=xyz,dc=com'.format(domain_name), '("(&(objectClass=user)(memberOf:1.2.840.113556.1.4.1941:=CN=Project Share,OU=Management,OU=Support,OU=Region 1))', attributes=[ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES])

My AD tree is as follows:
int.xyz.com (domain)
|____Region 1 (OU)
     |____Support (OU)
          |____ Management (OU) 
                |____User1 (Member of Project Share)
                |____User2 (Member of Leaders Share)
                |____User3 (Member of Project Share)

Results must show attributes of User1 and User3
Getting error: 

ldap3.core.exceptions.LDAPInvalidFilterError: invalid filter

A:

It looks like you have a typo in the filter, which should be:
'(&(objectClass=user)(memberOf:1.2.840.113556.1.4.1941:=CN=Project Share,OU=Management,OU=Support,OU=Region 1))'

