sub GetAgedComps { my $filter = FILTER_WORKSTATION_TRUST_ACCOUNT; my $level = 2; my $fudge = 120960; my $conversion = 86400; my ($server, $age, $silent) = @_; my (@machines, $comp, %info, %accts, $buf, $x); print " Pulling information from $server...\t\t" unless $silent; if (UserEnum($server, \@machines, $filter)) { print"[OK]\n" unless $silent; } else { print "[FAILED]\n" unless $silent; die " Unable to retreive information from $server: $!\n" } my $count = @machines; print " Checking for aged accounts...\t\t\t" unless $silent; foreach $comp (@machines) { unless ($silent) { $x++; #note, the funny char is a ^H print "" x length($buf) if $buf; print $buf = "[$x/$count]"; } unless (UserGetInfo($server, $comp, $level, \%info)) { die "\n Error retreiving information for $comp: $!\n"; } if (($info{'passwordAge'} - $fudge) / $conversion > $age ) { ($accts{$comp}) = int (($info{'passwordAge'} - $fudge) / $conversion); } } print "\n" unless $silent; return \%accts; }