I can't help with your script, but I can provide you with one i use. This lists all users in an Everyone OU
my $ldap = Net::LDAP->new('lucille.domain.com') or die ; # params for Net::LDAP::new # bind to a directory with dn and password my $mesg = $ldap->bind( 'ad_user', password => '******' ); my $fields = ['displayName','memberOf']; my $result = $ldap->search ( base => "ou=Everyone,dc=domainname,dc=com", filter => '(cn=*)', attrs => $fields, ); for my $item ( $result->entries) { next unless defined $item->get_value("displayName"); my $user; $user->{groups} = [ ref ( $item->get_value('memberOf') ) ? @{$item->get_value('memberOf')} : ($item->get_value('memberOf')) ]; $user->{groups} = [ map { /CN=(.+?),/ ; $1 } @{$user->{groups}} ]; print '"',$item->get_value("displayName"),'",'; print join(",", map { '"' . $_ . '"' } sort @{$user->{groups}} +),"\n"; }
This logs in to LDAP and generates a CSV file with each members display name and then a list of their groups.
In reply to Re: Enumerate MS AD Group Membership
by eric256
in thread Enumerate MS AD Group Membership
by c.m.hurley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |