Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Time of last login

by rupesh (Hermit)
on Jul 31, 2003 at 09:52 UTC ( [id://279522]=perlquestion: print w/replies, xml ) Need Help??

rupesh has asked for the wisdom of the Perl Monks concerning the following question:

Hey monks!
Is there a script which would list, given a domain, all users who have logged in to the machines in that domain and their last login time?
Thanks

Update: My query is related to Windows NT/2000.

we're born with our eyes closed and our mouths wide open, and we spend our entire life trying to rectify that mistake of nature. - anonymous.

Update per author - dvergin 2003-07-31

Replies are listed 'Best First'.
Re: Time of last login
by phydeauxarff (Priest) on Jul 31, 2003 at 15:08 UTC
    I haven't managed a Win32 system since way back in the day but I seem to recall that you can get some of this from the security log...though I might just be getting old ;-)

    Anyway, I have been looking at the Win32:: modules on CPAN lately to think about how I could manage my access to shares on our network and I noticed there is a module Win32::EventLog that allows you to access the event logs.

    Hope this gets you started in the general direction you are seeking.

Re: Time of last login
by slayven (Pilgrim) on Jul 31, 2003 at 10:29 UTC
    Depends on the environment of all machines in question. That is: operating system, services, users, kind of service used for login, logfiles storing these actions, etc.

    Depending on the answers the script may be a one-liner just firing a shell-command or 300 lines of code using various Modules and Packages for connecting different servers and services, parsing their response and validating the output.

    --
    trust in bash
    but tie your camel
Re: Time of last login
by Cine (Friar) on Jul 31, 2003 at 13:06 UTC
    If you are on a linux system, the "last" command would get you close. Probably also available on other *unixes.

    T I M T O W T D I
Re: Time of last login
by beernuts (Pilgrim) on Jul 31, 2003 at 15:37 UTC
    Never seen it in perl, but I'll bet if you google for a vbscript, one exists. If you do decide to implement it in perl, make sure you search every domain controller, otherwise you won't get accurate results.

    -beernuts
Re: Time of last login
by rupesh (Hermit) on Aug 01, 2003 at 10:35 UTC
    Hello Everyone,
    I was digging the net regarding this question and i found some inetersting commands, although its not a perl script:
    net user %username% /DOMAIN|find /i "last logon"
    and
    usrstat <domain name> from the windows resource kit which will give you the info for all the users in the domain.
    Thanks for your help so far


    we're born with our eyes closed and our mouths wide open, and we spend our entire life trying to rectify that mistake of nature. - anonymous.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://279522]
Approved by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-04-23 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found