using perl to get users of AD group

Viewed 3938

I've been trying to get this to print out all the members in "domain users". Problem is, it only prints out a small portion of them, then it just sorta stops. Not sure why. Can someone shed some light on the problem?

#!/usr/bin/perl

 use Net::LDAP;

 my $uid = "cn=account,cn=users,dc=domain,dc=local";
 my $bindPass = "password";
 my $ldapServer = "ldap://server.domain.local";

 # connect to ldap server
 $ldap = Net::LDAP -> new ($ldapServer) || die "Could not connect to server\n";

 # bind to ldap server
 $ldap -> bind($uid, password => $bindPass);

 # search for group
 $mesg = $ldap -> search(filter => "(&(cn=Domain Users))", base => "dc=domain,dc=local");

 $entry = $mesg -> entry;
# @members = $entry -> get_value ('member;Range=0-*');
 #the above entry when uncommented doesn't work either.
@members = $entry -> get_value ('member');

 foreach $thing (@members) {
   print "$thing\n";
}
1 Answers
Related