Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
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
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 for that!

share|improve this answer
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
It's better to post more than just the link (…) – fretje Aug 20 '09 at 14:03
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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