How can I tell when I logged into Windows?

17

4

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

skiphoppy

Posted 2009-08-20T13:56:57.920

Reputation: 2 193

5This question is fine for SuperUser. – random – 2009-08-20T14:03:19.237

Answers

14

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

gbjbaanb

Posted 2009-08-20T13:56:57.920

Reputation: 1 292

5you have to add /domain to the command, if you're on a domain... – fretje – 2009-08-20T14:12:23.310

ahah! in that case, my check of the local user worked perfectly. cheers – gbjbaanb – 2009-08-20T14:21:03.637

6

Open Command Prompt. at prompt, type 'quser' should display your logon username and time along with some other data.

Dave

Posted 2009-08-20T13:56:57.920

Reputation: 61

2

I see a lot of dancing around the event log answer, but not the exact answer, so I will give it.

  1. Go into the Event Viewer
  2. Expand Windows Logs (under Event Viewer)
  3. Choose Security (under Windows Logs)
  4. View the Task Category column for logons
  5. Click on a logon row and view the details to see if it is the user you are expecting.

demongolem

Posted 2009-08-20T13:56:57.920

Reputation: 425

2

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.

William Hilsum

Posted 2009-08-20T13:56:57.920

Reputation: 111 572

Good idea, though it requires Administrative rights (or authorization to change such settings). – Gnoupi – 2009-08-20T14:17:31.863

This is also not a solution if the OP wants to know NOW when he last logged on, before he configured auditing. – fretje – 2009-08-20T14:20:49.067

-1

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

DrJekl

Posted 2009-08-20T13:56:57.920

Reputation: 401

3

It's better to post more than just the link (http://meta.stackexchange.com/questions/15625/is-downvoting-link-only-answers-acceptable)

– fretje – 2009-08-20T14:03:57.673

3I 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 – 2009-08-20T14:07:16.903

-1

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

user3864

Posted 2009-08-20T13:56:57.920

Reputation:

3And more precisely, what to check ? Because the event logs tells a lot of things. – Gnoupi – 2009-08-20T14:11:46.680