Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: monitor users on win32

by joefission (Monk)
on Jul 20, 2001 at 22:03 UTC ( #98482=note: print w/replies, xml ) Need Help??


in reply to monitor users on win32

Sys Admin aspects to think about:
How often will you run the script?
Watch your security log settings. Make sure retention doesn't overwrite its contents more often than your script runs. Make sure log file maximum size will support the amount of data.
Look how the logon and logoff Audit Policy is set. Will you charge for a failed logon (bad password, expired account, account locked out)? It can skew your data.

Win32::AdminMisc::UserGetMiscAttributes is yet another method for getting a user's last logon. It won't give as much information as the EventLog, but is quick and easy to implement.

use Win32::AdminMisc; use strict; my $userName = 'me'; # Or gather user list with module my @server = ('PDC', 'BDC', 'Member' ); #Or use other means foreach my $server(@server) { Win32::AdminMisc::UserGetMiscAttributes("\\\\$server", $userName, +\my %Hash); next if $Hash{USER_LAST_LOGON} == 0; # didn't logon print "Last authentication (logon) for $userName in $server was ". +localtime($Hash{USER_LAST_LOGON})."\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://98482]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2020-05-30 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (172 votes). Check out past polls.

    Notices?