Python 3 pyad get_members: how to list more than 1500 members

1.2k Views Asked by At

Using pyad 0.6.0. Attempting to process members of an AD group. How do I get more than the initial 1500 group members returned by the pyad get_members() method/LDAP? Not finding much documentation regarding this method.

Thanks in advance, Dennis

1

There are 1 best solutions below

0
On

I had the same issue, solved it by just querying for all users with memberof and the group name.

import pyad.adquery

q = pyad.adquery.ADQuery()

q.execute_query(
    attributes = ["distinguishedName"],
    where_clause = f"objectClass = 'user' AND objectCategory = 'person' AND memberof = 'CN=GroupName,OU=Global,DC=company,DC=com'",
    base_dn = "DC=company, DC=com")

results = q.get_results()