By

So, how long was I at work yesterday ...

I work funny hours; sometimes I finish work at 3, sometimes 4 and sometimes 6. And I can never remember what hours I’ve worked.

Little tip to share that helps me remember. This only works if you hibernate or log off your [Windows] PC on leaving work.

Event Log

  1. Open Event Viewer (Start > Run EventVwr)
  2. Expand Windows Logs
  3. Right click on System, Filter Current Log …
  4. In Event sources: Copy+Paste “Kernel-Power, Power-Troubleshooter”, then click OK
  5. Right click on System, Save Filter to Custom View… and give it an appropriate name, e.g. Log on and off times

If you now expand Custom Views and select Log on and off times you’ll see something like this:

Windows Event viewer showing custom filter of log-on and off times

  • Kernel-Power tells you the time you slept or hibernated the computer.
  • Power-Troubleshooter tells you when the computer work up.

PowerShell

We can also get this information with PowerShell, in case, I dunno the Event Viewer decides to get corrupted and crash everytime you try and filter the results #truestory.

Get-EventLog -LogName System -Source Microsoft-Windows-Power-Troubleshooter,Microsoft-Windows-Kernel-Power -After (Get-Date).AddDays (-5) | Sort-Object Index | Select-Object @{Name='WhenLogged';Expression={Get-Date $_.TimeWritten -Format 'ddd dd-MMM-yy HH:mm'} };

Which will show log on and off times for the past week. Tweak the (Get-Date).AddDays(-5) setting for other date ranges.

Cover image by unsplash-logoEder Pozo Pérez

Posted in : tips

Written by
Founder, Developer, tea maker