I'm using perl to export records from LDAP. I did not write the script, so I don't even fully understand it. What I do know is that it binds to LDAP and exports records, but the 'lastlogin' field only exports on records 4 through 26. The other 14,000 records do not export that field. I've used Console1 to check records that did not export the lastlogin field, and a last login date does exist.
I'm completely puzzled, here is some code - I hope someone can offer a hint?
Should I be posting this in the perl section??
Thank you!
I'm completely puzzled, here is some code - I hope someone can offer a hint?
Should I be posting this in the perl section??
Code:
# ldap directory connection
$ldap=Net::LDAP->new($ldap_server);
open(OUTFILE,">Ldap_out.txt")
or die "Cannot open output file\n";
#bind
$ldap->bind(
dn => $ldap_dn,
password => $ldap_pw
);
$psearch=$ldap->search(
base => $ldap_basedn,
attr => ["uid","sn","givenname","location","cn","title","dn","mail","employeenumber","title","location","departmentnumber","uidNumber","telephoneNumber","logintime"],
filter => "(&(objectclass=Person)(objectClass=mailRecipient))"
);
foreach $pentry($psearch->all_entries){
$uid=$pentry->get("uid");
$sn=$pentry->get("sn");
$givenname=$pentry->get("givenname");
$location=$pentry->get("location");
$cn=$pentry->get("cn");
$title=$pentry->get("title");
$dn=$pentry->dn;
$mail=$pentry->get("mail");
$employeenumber=$pentry->get("employeenumber");
$departmentnumber=$pentry->get("departmentnumber");
$uidNumber=$pentry->get("uidNumber");
$phone=$pentry->get("telephoneNumber");
$login=$pentry->get("logintime");
Thank you!