Question

I want to check the operating system's start time. That is, for the last one month, the times when Windows was booted up. Is it possible to find this out?

Was it helpful?

Solution

PowerShell and System Event Log are perfectly designed for this task. Note events with id 12 is a System Start Up event while an id 13 indicates System Shutdown. The following PowerShell script will provide the start and shutdown time of your system in one month.

echo "Start time:"
Get-EventLog System -After 12/21/2011 | ? {$_.EventId -eq 12} | % {$_.TimeGenerated}
echo "Shutdown time:"
Get-EventLog System -After 12/21/2011 | ? {$_.EventId -eq 13} | % {$_.TimeGenerated}

Substitute the 12/21/2011 to any date you wish. Click Start Menu, type "powershell" and then enter will launch Windows PowerShell.

OTHER TIPS

it is possible in windows xp just type

systeminfo| find "System Up Time"

It will display system up time.

Here are the following steps to checking your systems startup \ uptime.

  1. Open up task manager (either from alt+ctrl+del, then clicking on "Start Task Manager", or from going to your start menus run command and typing "taskmgr.exe", then hitting enter).
  2. Click on the Perfomance tab
  3. Look for the System group near the bottom middle

It will then say Uptime in DD::HH::MM::SS format.

To figure out this information, you can write a program to grep through the Event Log

If you are attempting to have logs of all your startup and shutdown times, you are going to want some kind of a log. You can either write one your self, or you can take a look at what Microsoft has provided in Windows 7. To do so, take a look at the following tutorial.

http://www.sevenforums.com/tutorials/177443-gathering-startup-shutdown-sleep-hibernate-reboot-trace.html

Did you want to do this via programming code. As in C/C++ code?

GetTickCount64() returns the number of milliseconds since the system was started. Vista and up only. (So this should work for Windows 7).

If you have to run on operating systems older than Vista or Win2K8 server, there's plain old GetTickCount() - which loops back to zero after 49.7 days or so.

Then use the other time/date functions to get the current time. Subtract the value returned by GetTickCount or GetTickCount64 from the current time. That's when the system was last started up.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top