sub AD_enumerate_O ($$) { my $dn = shift; my $type = shift; $dn =~ s|^(LDAP://)?|LDAP://|; disable_ole_warnings; my $ou_hand = Win32::OLE->GetObject("$dn"); # this does not seem to work # $ou_hand->{Filter} = [ $type ]; enable_ole_warnings; if (not $ou_hand) { carp "WARNING: ".Win32::OLE::LastError."\n"; return undef; } my @list; foreach my $hand ( in $ou_hand ){ # other interesting properties are: # http://msdn.microsoft.com/library/en-us/netdir/adsi/iads.asp # also works for the 'other' properties of the entry next unless $hand->{Class} eq $type; #simpler than filter push @list, $hand; }; return [ @list ]; }