Note that there are some explanatory texts on larger screens.

plurals
  1. POSizeLimit exceeded using Net::LDAP::Control::Paged
    primarykey
    data
    text
    <p>According to all the documentation I've read, the maximum size of a result set when querying Active Directory is 1000 records. If you need more than 1000, you are told to use Net::LDAP::Control::Paged in order to page through and get more than 1000 records, which I have attempted to do. For some reason, I am still only getting 1000 records back, despite using a paged control. I am using the same code that others have claimed to be using successfully without any luck. Am I missing something here? Please note that I do not have administrative access to the AD servers, so changing the configuration is not an option for me. I've pasted the relevant code below so you can point out whatever I might have done wrong.</p> <pre><code>#!perl -w use strict; use Net::LDAP; use Net::LDAP::Control::Paged; use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED ); my $LDAPServer = "&lt;LDAP SERVER ADDRESS&gt;"; my $base = "&lt;BASE DN&gt;"; my $user = "&lt;LDAP USER&gt;"; my $pass = "&lt;PASSWORD&gt;"; my $page = Net::LDAP::Control::Paged-&gt;new(size =&gt; 1000) or die $!; my $errorConnectionStr = ""; my $ldap; my $mesg; my $cookie; $ldap = Net::LDAP-&gt;new($LDAPServer); $mesg = $ldap-&gt;bind($user, password =&gt; $pass, version =&gt; 3); open(OUT,"&gt;users.csv"); print OUT "sAMAccountName,sn,givenName\n"; my $filter = "(&amp;(objectClass=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(!(objectClass=computer)))"; my @attribs = ("sn", "givenName", "sAMAccountName", "distinguishedName"); my @args = ( base =&gt; $base, scope =&gt; 'sub', filter =&gt; $filter, attrs =&gt; @attribs, pagesize =&gt; 1000, control =&gt; [$page] ); while(1) { $mesg = $ldap-&gt;search(@args) or die $!; while (my $entry = $mesg-&gt;pop_entry()) { my $print = 1; my $dn = $entry-&gt;dn(); my $uid = $entry-&gt;get_value('sAMAccountName'); my $ln = $entry-&gt;get_value('sn'); my $fn = $entry-&gt;get_value('givenName'); if($dn =~ m/.*Resources.*/) { $print = 0; } if(defined($uid) &amp;&amp; defined($ln) &amp;&amp; defined($fn)) { if($print == 1) { print OUT "$uid,$ln,$fn\n"; } } } my ($resp) = $mesg-&gt;control(LDAP_CONTROL_PAGED) or last; $cookie = $resp-&gt;cookie or last; $page-&gt;cookie($cookie); } if($cookie) { print "Abnormal exit\n"; $page-&gt;cookie($cookie); $page-&gt;size(0); $ldap-&gt;search(@args); } close(OUT); $ldap-&gt;unbind; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload