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?)

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

4 Answers

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).

link|improve this answer
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
feedback

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.

link|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
feedback

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

link|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
feedback

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

link|improve this answer
3  
It's better to post more than just the link (meta.stackoverflow.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. – Jonathan Sampson Aug 20 '09 at 14:07
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.