How can I determine how long my Windows 8.1 PC has been up and running? Checking in task manager or using systeminfo command does not work, because they do not reset when you hibernate. I need to know the time my PC is turned on, not when the last boot from a real shutdown was.
-
P.S. I know you can check the duration of the WiFi connection or any other network connections, but those are unreliable.– GizmoCommented May 3, 2015 at 9:35
-
You could have a script which detects system pauses (Hibernated), and sets a timestamp, then you could have a read out showing the diff in time between now and then. But, that would only be testing for as long as the script was running, and would assume a Hibernate/Restart/Sleep if the script stops. Also, such a script would need to be running constantly. I have a set of scripts that determine network state for share creation, and it is really annoying how it is constantly in the taskbar– tophergCommented May 3, 2015 at 9:36
2 Answers
I created for you a custom event filter which lists events when the computer was powered on or returned from hibernate or standby. Open Event Viewer, click 'Create Custom View' and set the same as below to recreate it:
Here's an example of its output:
The 'Dhcp-client' source event is an actual full boot start-up, the others are returns from standby or hibernate.
It should also be possible to extract this data by command line, but I'm not clear if this is what you wanted.
-
It shows the previous system started after returning from hibernating, not the current session.– QkiZCommented Sep 12, 2022 at 10:51
Using PowerShell:
Get-WinEvent -MaxEvents 1 -FilterHashTable @{ProviderName='Microsoft-Windows-Power-Troubleshooter';LogName='System';ID='1'}
will output something like:
ProviderName: Microsoft-Windows-Power-Troubleshooter
TimeCreated Id LevelDisplayName Message
----------- -- ---------------- -------
2023/01/26 09:07:14 1 Information The system has returned from a low power state....
-
1This answer is more straightforward. Worked great for me. Thanks– PhenomeCommented Feb 8, 2023 at 1:44