Paul and fish,
Code works much faster now. Only having a problem when a users expiration date is set to never expire which as we learned will be equal to 19000100. SO, need to somehow incorporate that value into the script. In an earlierversion I had this:
if ($my_userexpdate == 19000100) {&Never_expires;}
if ($my_userexpdate != 19000100) {
if ($then_str <= $now_str) {
#Win32::NetAdmin::UserDelete($PDC, $user) or warn ("Unable to delete user: $!\n"

;
print "$user $drive will be deleted\n";
} else {print "$user $drive $my_userexpdate $then_str\n";
}
}
}
sub Never_expires {
print "$user will never expire\n";
}
####END
The last code:
#!D:/perl/bin/perl -w
use Win32::NetAdmin;
use Win32::AdminMisc;
use Time::Localtime;
#### Get the domain controller for the domain
Win32::NetAdmin::GetDomainController('', 'TADLP0' , $PDC);
#### retrieve all of the local users
Win32::NetAdmin::GroupGetMembers($PDC, 'Students', \@users) or die ("Unable to get users: $!\n"

;
### get their attributes and print them
$count = 0;
foreach $user (@users){
Win32::AdminMisc::UserGetMiscAttributes('',$user,\%attribs) or warn ("Unable to get attrib: $!\n"

;
$count++;
$now=&Get_d8(time);
$expdate = &Get_d8 ($attribs{'USER_ACCT_EXPIRES'});
$then=&Get_d8($attribs{'USER_ACCT_EXPIRES'}+5184000);
print "$user $now $expdate $then $count\n";
}
sub Get_d8 {
my $dte=shift;
if (defined $dte) {
my($d,$m,$y)=(localtime($dte))[3,4,5];
my $date=sprintf('%4d%02d%02d', 1900+$y, 1+$m, $d);
return $date;
} else {
return "Never Expires";
}
}
### END
Had this result:
Use of uninitialized value in addition (+) at A:\paul.pl line 28.
Use of uninitialized value in addition (+) at A:\paul.pl line 28.
Use of uninitialized value in sprintf at A:\paul.pl line 28.
TWAD4188 20030619 19000100 19700301 1
JMAM1422 20030619 20030817 20031016 2
TGAM4420 20030619 20030822 20031021 3
KSAM8548 20030619 20030826 20031025 4
I took out a few
MJAM1065 20030619 20030518 20030717 36
ELAM0574 20030619 20031018 20031216 37
DJAD6377 20030619 20030530 20030729 38
CSAM6235 20030619 20031018 20031216 39
I took out a few
RVAM4558 20030619 20030519 20030718 45
JSAM1839 20030619 20030823 20031022 46
SCAM8108 20030619 20030817 20031016 47
Use of uninitialized value in addition (+) at A:\paul.pl line 28.
Use of uninitialized value in addition (+) at A:\paul.pl line 28.
Use of uninitialized value in sprintf at A:\paul.pl line 28.
RAAC7033 20030619 19000100 19700301 48
HLAM5896 20030619 20030608 20030807 49