Time when Windows 7 was started/booted

11,104

Solution 1

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.

Solution 2

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.

Solution 3

it is possible in windows xp just type

systeminfo| find "System Up Time"

It will display system up time.

Solution 4

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

Solution 5

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

Share:
11,104
Bhavik Ambani
Author by

Bhavik Ambani

Working as Architect at Myntra, Bangalore. GitHub Hacker Rank Quora Career 2.0 Profile LinkedIn Profile Facebook Google+ Skype Id - bhavik-ambani Bhavik Ambani

Updated on June 12, 2022

Comments

  • Bhavik Ambani
    Bhavik Ambani about 2 years

    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?

  • Bhavik Ambani
    Bhavik Ambani over 12 years
    Thanks for the post but I dont want uptime of the system, I want the time when system was started and shutdown for the last one month. But here it gives only the uptime same.
  • Bhavik Ambani
    Bhavik Ambani over 12 years
    But please give me code to write, I am not aware of any of the code
  • josephthomas
    josephthomas over 12 years
    I am sorry, I must have interpreted your question wrong. I posted what is hopefully a more appropriate answer down below.
  • cwhisperer
    cwhisperer over 12 years
    This is even better than my idea
  • Bhavik Ambani
    Bhavik Ambani over 12 years
    @grapeot When i execute the command it gives following error message Get-EventLog : Cannot bind parameter 'After'. Cannot convert value "12/21/2011" to type "System.DateTime". Error: "Stri ng was not recognized as a valid DateTime." At line:1 char:27 + Get-EventLog System -After <<<< 12/21/2011 | ? {$_.EventId -eq 12} | % {$_.TimeGenerated} + CategoryInfo : InvalidArgument: (:) [Get-EventLog], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands‌​.GetEventLogCommand
  • grapeot
    grapeot over 12 years
    I suppose this is because you are using PowerShell 1.0 rather than the latest 2.0. Could you please try Get-EventLog System -After ([DateTime]::Parse('12/21/2011')) | ? {$_.EventId -eq 12} | % {$_.TimeGenerated}? Note we change 12/21/2011 into ([DateTime]::Parse('12/21/2011')). Please let me know if this still doesn't work. I'm sorry but I don't have PS 1.0 environment at hand. Or if you wish, you can upgrade to PS 2.0 with this patch.
  • Bhavik Ambani
    Bhavik Ambani over 12 years
    Thanks but still it gives me this error Exception calling "Parse" with "1" argument(s): "String was not recognized as a valid DateTime." At line:1 char:46 + Get-EventLog System -After ([DateTime]::Parse <<<< ('12/21/2011')) | ? {$_.Ev entId -eq 12} | % {$_.TimeGenerated} + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
  • Bhavik Ambani
    Bhavik Ambani over 12 years
    I dont want to know the current days system startuo time, If I wanted that then mechanism sugggested by josephthomas in answers is good, but I want to know the system boot time for the last say for example one month etc.
  • Saurav Seth
    Saurav Seth over 12 years
    @BhavikAmbani -You wanted to find the list of all the different times the system was (re)started? That was not obvious based on the title of your question. You want "times" not "the time".
  • grapeot
    grapeot over 12 years
    I am sorry but currently I don't know where is the problem... It passed the test in my PS 2.0 and Windows 7... Or could you please try the following code: Get-EventLog System -Newest 10000 | ? {$_.EventId -eq 12} | % {$_.TimeGenerated}? By this way we can avoid the DateTime problem. But this code is actually parsing the latest 10000 events, you may need to adjust the event number to make the result include the last month.
  • René Nyffenegger
    René Nyffenegger over 10 years
    +1, it's the easiest way for that task, imho.
  • Lilienthal
    Lilienthal about 9 years
    For Windows 7 search for "System Boot Time" instead.
  • SilverbackNet
    SilverbackNet almost 6 years
    Never use local date strings in examples. Always use ISO format, like 2011-12-21, or you will encounter lots of problems with people who have non-American date formats.
  • SilverbackNet
    SilverbackNet almost 6 years
    It doesn't even need a hardcoded date anyway, (Get-Date).AddMonths(-1) is the general answer.