Now my question is: is there a better way to do it? It works fine, but that doesn't mean that there isn't a more apropriate way to handle it.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; }
Thanks,
Rich
PS - this pulls NT machine trust accounts that haven't been accesed in over a certian number of days. I was planning on posting it here once I have it cleaned up.
In reply to Manipulating cursor position when printing to STDOUT by rchiav
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |