I'm not sure about DBD::ADO, but this code works.. I'm pretty sure tis will look very similar to your VB code.
Steven ------------------ use Win32::OLE qw (in); # base functionality use Win32::OLE::Variant; query_ldap("<LDAP://OU=someou,dc=somedomain,dc=net>;(objectclass=User);adspath,cn,whenCreated;subtree",$objects); print "recordcount = ".$objects->{RecordCount}."\n"; while (!$objects->{EOF}) { print $objects->Fields("adsPath")->{Value}." --" . $objects->Fields("whenCreated")->{Value} ."\n"; $objects->MoveNext(); } sub query_ldap { my $ldap_query = $_[0]; my $error_num; my $error_name; my $RS; my $Conn = Win32::OLE->new("ADODB.Connection"); if (Win32::OLE->LastError() != 0) { print "Failed creating ADODB.Connection object (".Win32::OLE->LastError().")\n -> $ldap_query\n"; return 0; } $Conn->{'Provider'} = "ADsDSOObject"; if (Win32::OLE->LastError() != 0) { print "Failed setting ADODB.Command Provider (".Win32::OLE->LastError().")\n -> $ldap_query\n"; return 0; } $Conn->{Open} = "Perl Active Directory Query"; my $Cmd = Win32::OLE->new("ADODB.Command"); if (Win32::OLE->LastError() != 0) { print "Failed creating ADODB.Command object (".Win32::OLE->LastError().")\n -> $ldap_query\n"; return 0; } $Cmd->{CommandText} = $ldap_query; $Cmd->{Properties}->{"Page Size"} = 99; $Cmd->{ActiveConnection} = $Conn; $RS = $Cmd->Execute(); if (Win32::OLE->LastError() != 0) { print "Failed Executing ADODB Command object (".Win32::OLE->LastError().")\nExecuting ADODB Command -> $ldap_query\n"; return 0; } else { $_[1] = $RS; return 1; } } > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Zack, Joelle M. > Sent: Thursday, August 16, 2007 8:54 AM > To: perl-win32-users@listserv.ActiveState.com > Subject: DBI record limitations when querying AD > > 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','use > rprincipalname' > 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 > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs