Hello Everyone
I wrote a Perl script to gather NIS and Active directory info. The issue I am having is the only way I have been able to enumerate AD is with this snippet. The $sNisInfo contains the "userID:GrpName:UserRealName:" from NIS.
$result = $ldap->search(
base => "dc=mycompany,dc=com",
filter => "sAMAccountName=$sZid",
);
# die $result->error if $result->code;
foreach my $entry ($result->entries) {
printf OUTPUT "$sNisInfo:%s:%s:%s:%s\n",
$entry->get_value("displayName"),
$entry->get_value("telephoneNumber"),
$entry->get_value("l"),
$entry->get_value("mail");
}
I get an error whenever a user ID in AD does not have the info I am searching for filled out I get "Use of uninitialized value in printf". How do I get printf to just leave the value blank if it is empty and not error out. Thanks in advance for any help.
Randy
I wrote a Perl script to gather NIS and Active directory info. The issue I am having is the only way I have been able to enumerate AD is with this snippet. The $sNisInfo contains the "userID:GrpName:UserRealName:" from NIS.
$result = $ldap->search(
base => "dc=mycompany,dc=com",
filter => "sAMAccountName=$sZid",
);
# die $result->error if $result->code;
foreach my $entry ($result->entries) {
printf OUTPUT "$sNisInfo:%s:%s:%s:%s\n",
$entry->get_value("displayName"),
$entry->get_value("telephoneNumber"),
$entry->get_value("l"),
$entry->get_value("mail");
}
I get an error whenever a user ID in AD does not have the info I am searching for filled out I get "Use of uninitialized value in printf". How do I get printf to just leave the value blank if it is empty and not error out. Thanks in advance for any help.
Randy