问题
Using the following code...
import win32com.adsi
DNC=win32com.adsi.ADsGetObject('LDAP://rootDSE').Get('DefaultNamingContext')
path = 'LDAP://cn=BIG_GROUP,ou=Groups,'+DNC
groupobj = win32com.adsi.ADsGetObject(path)
users = groupobj.member
print len(users)
The output is always a maximum 1500, even if BIG_GROUP contains several thousand members. How can I execute this query in a way that returns all members of BIG_GROUP?
回答1:
AD returns N results at a time from a large attribute (like member), where N is the max range retrieval size. The directory supports something called ranged retrieval where you can fetch groupings of up to 1500 values per fetch.
You should use the ranged retrieval control against the directory. I don't know if your LDAP API supports this but the docs should answer.
Here is a bit more in the way of info, from the MSFT docs
来源:https://stackoverflow.com/questions/11058480/python-win32com-adsi-module-limits-number-of-returned-members-from-ad