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

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

This is because Task Manager or WMI wouldn’t deduct the sleep/hibernation time when calculating up time, and with Fast Startup introduced and enabled by default in Windows 8 (and higher), the Up time reported may not match with your actual last boot up time.

Fast startup is a hybrid of cold startup + hibernate; when you shutdown 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 logon screen will be quicker (30-70 % faster). If you have old hardware you may not see much difference in startup times.

Different Ways to Find the System Up time

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

PowerShell

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

Here is the Uptime information shown.

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 get os 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

So, every method showed the same Up time varying only a little (because of time interval for taking screenshots for each item).

But the fact is, the Up time shown using every method also includes the hibernate time. The actual uptime should be exactly 5 hrs, 55 minutes as of the time I’m writing this post. And you can verify that by checking shutdown and logon 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 Up time Without Disabling Fast startup

Launch Services.msc and stop Windows Management Instrumentation service. You’ll be prompted to stop the dependant services. Click Yes.

Open the folder C:\Windows\System32\Wbem\Repository

Delete all the files there. 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 Up time would continue to show the aggregated figure instead of the correct Up time.

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 Up time. Also test if the Up time is refreshed in every subsequent restart. 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.

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.

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

Comments are closed.