From: Perl <Pe...@ny...> - 2002-12-27 05:48:39
|
I am trying to understand why this doesn't work. I am trying to list all attributes associated with the base search path. The problem is that nothing below CN=3DServices is ever displayed. I run the script and it returns nothing. I know the attributes are there as I can view them using LDP.EXE. If I modify the script to search CN=3DServices I see them just fine. I have 2 questions: 1) Anything below CN=3DServices does not return any attributes. Why? I = can see them in LDP but can't get them to print using this script. 2) Is there a preferred method to getting attributes in this manner? Ultimately what I am trying to do is populate a list of Exchange 2000 servers that exist in the organization. I want to do a recursive search under: "CN=3DAdministrative Groups,CN=3DMYTESTDOMAIN,CN=3DMicrosoft Exchange,CN=3DServices,CN=3DConfiguration,DC=3Dmynetwork,DC=3Dcom" but I = can't seem to get any attributes to show.=20 Any help very appreciated. --Paul ---- use Net::LDAP qw(:all); =20 use Net::LDAP::Util qw(ldap_error_name =20 ldap_error_text) ; =20 =20 $ldap =3D Net::LDAP->new("newyork",port =3D> '3268') or die "$@"; $ldap->bind; # use for searches my $result =3D $ldap->search ( base =3D> "CN=3DMicrosoft Exchange,CN=3DServices,CN=3DConfiguration,DC=3Dmynetwork,DC=3Dcom", scope =3D> "sub", filter =3D> '(objectclass=3D*)', attrs =3D> ['*'] ); =20 =20 my @entries =3D $result->entries; my $entr ; foreach $entr ( @entries ) { print "DN: ",$entr->dn,"\n"; #my @attrs =3D sort $entr->attributes; my $attr; foreach $attr ( sort $entr->attributes ){ #skip binary we can't handle next if ( $attr =3D~ /;binary$/ ); print " $attr : ",$entr->get_value($attr),"\n"; } #print "@attrs\n"; print "#-------------------------------\n"; } |