• <tfoot id='FllBF'></tfoot>
  • <legend id='FllBF'><style id='FllBF'><dir id='FllBF'><q id='FllBF'></q></dir></style></legend>

    <small id='FllBF'></small><noframes id='FllBF'>

  • <i id='FllBF'><tr id='FllBF'><dt id='FllBF'><q id='FllBF'><span id='FllBF'><b id='FllBF'><form id='FllBF'><ins id='FllBF'></ins><ul id='FllBF'></ul><sub id='FllBF'></sub></form><legend id='FllBF'></legend><bdo id='FllBF'><pre id='FllBF'><center id='FllBF'></center></pre></bdo></b><th id='FllBF'></th></span></q></dt></tr></i><div id='FllBF'><tfoot id='FllBF'></tfoot><dl id='FllBF'><fieldset id='FllBF'></fieldset></dl></div>
      <bdo id='FllBF'></bdo><ul id='FllBF'></ul>

        克服 Active Directory 的 1000 条记录限制

        时间:2023-07-24

          <bdo id='lzAlb'></bdo><ul id='lzAlb'></ul>

            <tfoot id='lzAlb'></tfoot>
          1. <small id='lzAlb'></small><noframes id='lzAlb'>

              <tbody id='lzAlb'></tbody>
            <legend id='lzAlb'><style id='lzAlb'><dir id='lzAlb'><q id='lzAlb'></q></dir></style></legend>
            <i id='lzAlb'><tr id='lzAlb'><dt id='lzAlb'><q id='lzAlb'><span id='lzAlb'><b id='lzAlb'><form id='lzAlb'><ins id='lzAlb'></ins><ul id='lzAlb'></ul><sub id='lzAlb'></sub></form><legend id='lzAlb'></legend><bdo id='lzAlb'><pre id='lzAlb'><center id='lzAlb'></center></pre></bdo></b><th id='lzAlb'></th></span></q></dt></tr></i><div id='lzAlb'><tfoot id='lzAlb'></tfoot><dl id='lzAlb'><fieldset id='lzAlb'></fieldset></dl></div>

                • 本文介绍了克服 Active Directory 的 1000 条记录限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  PowerShell 能够提取 1492 条记录的列表.当我将 Python 与 ldap3 模块一起使用时,我遇到了 1000 条记录的限制.请帮我更改 Python 代码以超出限制.

                  PowerShell is capable of pulling list of 1492 records. When I using Python with ldap3 module I'm bumping into 1000 records limit. Please help me change Python code to exceed the limit.

                  PowerShell 输入:get-aduser -filter * -SearchBase "OU=SMZ USERS,OU=SMZ,OU=EUR,DC=my_dc,DC=COM" |测量对象

                  PowerShell input: get-aduser -filter * -SearchBase "OU=SMZ USERS,OU=SMZ,OU=EUR,DC=my_dc,DC=COM" | Measure-Object

                  输出:计数:1492平均 :总和:最大限度 :最低限度 :属性:

                  output: Count : 1492 Average : Sum : Maximum : Minimum : Property :

                  import json
                  from ldap3 import Server, 
                  Connection, 
                  AUTO_BIND_NO_TLS, 
                  SUBTREE, 
                  ALL_ATTRIBUTES
                  
                  def get_ldap_info(u):
                  with Connection(Server('my_server', port=636, use_ssl=True),
                                  auto_bind=AUTO_BIND_NO_TLS,
                                  read_only=True,
                                  check_names=True,
                                  user='my_login', password='my_password') as c:
                  
                      c.search(search_base='OU=SMZ Users,OU=SMZ,OU=EUR,DC=my_dc,DC=com',
                               search_filter='(&(samAccountName=' + u + '))',        
                               search_scope=SUBTREE,
                               attributes=ALL_ATTRIBUTES,
                               size_limit = 0,
                               paged_criticality = True,                 
                               paged_size = None,
                               #attributes = ['cn'],
                               get_operational_attributes=True)        
                  
                      content = c.response_to_json()
                  result = json.loads(content)
                  i = 0
                  for item in result["entries"]:
                      i += 1
                  print(i)  
                  get_ldap_info('*')
                  

                  推荐答案

                  如果您将代码更改为使用 extend.standard 命名空间的 paged_search 方法,您应该能够检索到您正在寻找的所有结果.

                  If you change your code to using the paged_search method of the extend.standard namespace instead you should be able to retrieve all the results you are looking for.

                  请注意,您需要区别对待响应对象.

                  Just be aware that you will need to treat the response object differently.

                  def get_ldap_info(u):
                  with Connection(Server('XXX', port=636, use_ssl=True),
                                  auto_bind=AUTO_BIND_NO_TLS,
                                  read_only=True,
                                  check_names=True,
                                  user='XXX', password='XXX') as c:
                  
                      results = c.extend.standard.paged_search(search_base='dc=XXX,dc=XXX,dc=XXX',
                               search_filter='(&(samAccountName=' + u + '))',        
                               search_scope=SUBTREE,
                               attributes=ALL_ATTRIBUTES,
                               #attributes = ['cn'],
                               get_operational_attributes=True)        
                  
                  
                  i = 0
                  for item in results:
                      #print(item)
                      i += 1
                  print(i)  
                  get_ldap_info('*')
                  

                  这篇关于克服 Active Directory 的 1000 条记录限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何查找用户所属的所有组?(LDAP) 下一篇:使用 Django Auth Ldap 将 LDAP 用户映射到 Django 用户

                  相关文章

                • <small id='JLZ0o'></small><noframes id='JLZ0o'>

                    <bdo id='JLZ0o'></bdo><ul id='JLZ0o'></ul>
                  <tfoot id='JLZ0o'></tfoot>
                      <legend id='JLZ0o'><style id='JLZ0o'><dir id='JLZ0o'><q id='JLZ0o'></q></dir></style></legend>
                      <i id='JLZ0o'><tr id='JLZ0o'><dt id='JLZ0o'><q id='JLZ0o'><span id='JLZ0o'><b id='JLZ0o'><form id='JLZ0o'><ins id='JLZ0o'></ins><ul id='JLZ0o'></ul><sub id='JLZ0o'></sub></form><legend id='JLZ0o'></legend><bdo id='JLZ0o'><pre id='JLZ0o'><center id='JLZ0o'></center></pre></bdo></b><th id='JLZ0o'></th></span></q></dt></tr></i><div id='JLZ0o'><tfoot id='JLZ0o'></tfoot><dl id='JLZ0o'><fieldset id='JLZ0o'></fieldset></dl></div>