Software >> OS >> Windows >> API >> ADSI >> Perl >>  How to search for groups in a particular OU and display their members

use Win32::OLE; use Win32::OLE qw( in ); $oContainer = Win32::OLE->GetObject("LDAP://OU=Postgrad,OU=Distribution List,DC=student,DC=main,DC=somecollege,DC=edu"); $oContainer->{Filter} = ["group"]; foreach $oGroup (in $oContainer) { $name = $oGroup->{'Name'}; print "Name=$name\n"; } foreach $oGroup (in $oContainer) { $oMembers = $oGroup->{'Members'}; foreach $oMember (in $oMembers) { print $oMember->{"Name"} . "\n"; } }