Incorrect Uptime Reported by Task Manager and WMI. Refresh it Manually

Task Manager’s Performance tab (CPU section) shows the Uptime information of the system, but you may be wondering why your boot up time doesn’t match the Uptime data reported.

This is because Task Manager or WMI wouldn’t deduct the duration of sleep/hibernation when calculating uptime. And, with Fast Startup introduced and enabled by default in Windows 8 and Windows 10, the uptime reported may not correlate with your actual last boot up time.

Cause

Fast startup is a hybrid of cold startup + hibernate. When you shut down the computer with fast startup enabled, the user accounts are logged off completely. Then the system goes to hibernate mode (instead of traditional cold shutdown) so that the next boot up till the login screen will be quicker (30-70 % faster).

Different Ways to Find the System Uptime

There are some of the methods you can use to find the Uptime of your computer, all using WMI.

PowerShell

[DateTime]::Now – [Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject Win32_OperatingSystem).LastBootUpTime))

Here is the Uptime information.

SystemInfo

From a Command Prompt window, run:

systeminfo | find /i "Boot Time"

Net Statistics

From a Command Prompt window, run:

net statistics workstation

WMIC (WMI’s Command-line Interface)

wmic os get lastbootuptime

That’s in WMI time. But exactly means the same as 1 & 2 above.

Microsoft Uptime.exe utility

Uptime showed the same.

Task Manager

Task Manager and WMI show incorrect uptime

Every method above showed the same uptime, varying only by a few seconds/minutes, because of the time interval taken for taking screenshots for each item.

But the fact is, the uptime is shown using every method also includes the hibernate time. The actual uptime should be 5 hrs, 55 minutes as of the time (08:24 PM) I’m writing this post. And you can verify that by checking shutdown and login events in Event Viewer.



Refreshing the uptime

Running the following command shuts down (cold shutdown) the system completely. But the benefits of fast startup won’t be available for the next boot.

shutdown /s /t 0

(or)

Click Start, Power and click Restart (instead of Shutdown)

Disabling Fast Startup

If you want to disable fast startup, you can do so via Power Options.

  • Open Control Panel, Power Options.
  • Click Choose what the power buttons do
  • Click Change settings that are currently unavailable
  • Uncheck Turn on fast startup (recommended), and click OK.

Refresh the uptime Without Disabling Fast startup

  1. Launch Services.msc and stop Windows Management Instrumentation service.
  2. You’ll be prompted to stop the dependent services. Click Yes.
  3. Open the folder C:\Windows\System32\Wbem\Repository
  4. Delete all the files there.
  5. Restart Windows. You’ll note Up time showing up the actual last boot up time using any of the above methods, including the Task Manager.

But the problem is that you need to clear the WMI repository at every shutdown, or else the uptime would continue to show the aggregated figure.

Create a Batch File and Run as a Shutdown Script (Windows Pro Editions and higher)

You may create a Batch file with the following contents:

net stop iphlpsvc >d:\wmireset.txt
net stop ncasvc >>d:\wmireset.txt
net stop sharedaccess >>d:\wmireset.txt
net stop wscsvc >>d:\wmireset.txt
net stop winmgmt >>d:\wmireset.txt
sc query winmgmt >>d:\wmireset.txt
rd /s /q "C:\Windows\System32\wbem\repository" >>d:\wmireset.txt
md "C:\Windows\System32\wbem\repository"
date /t >>d:\wmireset.txt
time /t >>d:\wmireset.txt

That writes the batch file output along with the timestamp to a text file named wmireset.txt to know when was the batch file last run.

Then open the Local Group Policy Editor (gpedit.msc) and go to:

Computer Configuration > Scripts (Startup/Shutdown)

Add your Batch file there and click OK. Restart Windows and check the uptime. Also, test if the uptime is refreshed in the subsequent restarts. Although I’ve not benchmarked the fast startup times before clearing the WMI repository and after, it may delay your startup time as Windows has to rebuild the repository at every start.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right here. :)

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

1 thought on “Incorrect Uptime Reported by Task Manager and WMI. Refresh it Manually”

Leave a Comment