Software >> OS >> Windows >> API >> ADSI >> Perl >>  How to get the members of a domain group given the full Distinguished Name (DN) of the group

ADSI::Perl:: use File::Basename; use Win32::OLE; use Win32::OLE qw( in ); $prog = basename(replacebegin:content:replaceend); if($#ARGV < 0) { die "\nUsage: $prog <ldap_path>\n"; } $ldap_path = $ARGV[0]; print "$ldap_path\n"; #eg. $prog "LDAP://CN=Master of Engineering,ou=Postgrad,ou=Distribution List,dc=student,dc=main,dc=somecollege,dc=edu"; $oContainer = Win32::OLE->GetObject($ldap_path); $oContainer->{Filter} = ["user"]; $oMembers = $oContainer->{'Members'}; foreach $oMember (in $oMembers) { $cn = $oMember->{'Name'}; $displayname = $oMember->{'DisplayName'}; print $displayname . "\n"; }