Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On UNIX I can tell when I logged in and out of my workstation with the last command. Is there a way to get the same information on my Windows workstation?

I notice that Cygwin has a last command, but wtmp doesn't seem to be populated. Is there a way to get last working with Cygwin?

(If this can only be done programmatically, should the question be on StackOverflow?)

share|improve this question
5  
This question is fine for SuperUser. – random Aug 20 '09 at 14:03

You can try "net user < username >" - one of the many results will be the 'Last logon' time (note: I've only tried this on a domain workstation, not a standalone one, so your results may be slightly different).

share|improve this answer
1  
you have to add /domain to the command, if you're on a domain... – fretje Aug 20 '09 at 14:12
    
ahah! in that case, my check of the local user worked perfectly. cheers – gbjbaanb Aug 20 '09 at 14:21

If you go to Control Panel > Administrative Tools > Local Security Policy, there is a bunch of audits you can set up including Logon and Logoff.

After setting this up (and performing a restart), all the details should appear in the event log.

share|improve this answer
    
Good idea, though it requires Administrative rights (or authorization to change such settings). – Gnoupi Aug 20 '09 at 14:17
    
This is also not a solution if the OP wants to know NOW when he last logged on, before he configured auditing. – fretje Aug 20 '09 at 14:20

you can check the windows events logs http://support.microsoft.com/kb/308427 for that!

share|improve this answer
3  
And more precisely, what to check ? Because the event logs tells a lot of things. – Gnoupi Aug 20 '09 at 14:11

Does this work for you: Last login time in VBScript?

share|improve this answer
3  
It's better to post more than just the link (meta.stackexchange.com/questions/15625/…) – fretje Aug 20 '09 at 14:03
3  
I don't personally mind a link-answer, as long as I don't have to click it to understand what it is. "Does this work for you" doesn't tell me anything. – Sampson Aug 20 '09 at 14:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .