Python win32com.adsi module limits number of returned members from AD

落爺英雄遲暮 提交于 2019-12-12 03:47:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!