r/PowerShell • u/GonzoZH • Jan 05 '26
Get-WorkTime: Simple PowerShell module to summarize work time from Windows event logs
Hi PowerShellers,
Maybe it is useful for others as well:
Since I track my work time, I often can’t remember on Friday how I actually worked on Monday, so I needed a small helper.
Because my work time correlates pretty well with my company notebook’s on-time, I put together a small PowerShell module called Get-WorkTime.
It reads boot, wake, shutdown, sleep, and hibernate events from the Windows System event log and turns them into simple daily summaries (start time, end time, total uptime). There’s also an optional detailed view if you want to see individual sessions.
In case of crashes, it uses the last available event time and marks the inferred end time with a *. The output consists of plain PowerShell objects, so it’s easy to pipe into CSV or do further processing.
The code is on GitHub here: https://github.com/zh54321/Get-WorkTime
Feedback or suggestions are welcome.
Cheers
10
u/Th3Sh4d0wKn0ws Jan 05 '26
Adding a separate comment: This is really neat. One thing I was working on a while ago was auditing computer use for a given login session by looking at the login, lock, unlock and logoff events. Tracking by computer uptime makes sense it sounds like for your scenario, but at my org a lot of people just leave their computers on so the only indicators in Event Viewer about their work time are when they login, and when the computer is unlocked/locked.
3
u/voytas75 Jan 05 '26
Nice. Is it similar to TurnedOnTimesView from NirSoft?
2
u/digsmann Jan 05 '26
Sounds interesting, buddy... will play with it... Happy holidays!
3
u/cloudAhead Jan 05 '26
Neat script. I generally leave my laptop on 24x7, though.
3
u/felipefideli Jan 05 '26
Really cool. It would be awesome if it could query others if you have admin privileges.
-8
u/Thyg0d Jan 05 '26
I don't see why it would be a problem and it's just a tank, nothing gets out of it into the machine.