I'm using DBI to query data from my active directory.  I have the script 
working and I can return the user data that I'm looking for, but I can only get 
1000 rows back.  I understand that there is a default limitation in AD that 
allows only 1000 rows to be returned at a time, but in VBS I can set a "Page 
Size" property so that I can bring back multiple pages of 1000 entries at a 
time.

Does anyone know how or if I could use a page size parameter within DBI to do 
the same sort of thing?

Here's what my script looks like:

use DBI;
use DBD::ADO;
use strict;

# Query AD for Proxy servers
my $dsn = "Provider=ADsDSOObject";
if (my $dbh = DBI->connect("dbi:ADO:$dsn")){
    my @UserData;
    # Query Active Directory user records
    my $SQL = "select 
'cn','sn','givenname','initials','telephonenumber','mail','userprincipalname'
            from 'LDAP://mydomain.com/DC=mydomain,DC=com'
            where objectClass='user' and cn <> 'vn*' ";
    my $sth = $dbh->prepare($SQL);
    if ($sth->execute) {
        my $records = $sth->fetchall_arrayref;
        foreach my $user (@$records){
                  my $userid = $user->[6];
                  my $lastname = $user->[5];
                  my $firstname = $user->[4];
                  my $initial = $user->[3];
                  my $phone = $user->[2];
                  my $email = $user->[1];
                  my $internalemail = $user->[0];
        }
    }
      $sth->finish;
}

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to