Time when Windows 7 was started/booted
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
.
- 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). - Click on the
Perfomance
tab - 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.
![Bhavik Ambani](https://i.stack.imgur.com/zlXI4.jpg?s=256&g=1)
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, 2022Comments
-
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 over 12 yearsThanks 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 over 12 yearsBut please give me code to write, I am not aware of any of the code
-
josephthomas over 12 yearsI am sorry, I must have interpreted your question wrong. I posted what is hopefully a more appropriate answer down below.
-
cwhisperer over 12 yearsThis is even better than my idea
-
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 over 12 yearsI 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 change12/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 over 12 yearsThanks 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 over 12 yearsI 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 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 over 12 yearsI 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 theDateTime
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 over 10 years+1, it's the easiest way for that task, imho.
-
Lilienthal about 9 yearsFor Windows 7 search for "System Boot Time" instead.
-
SilverbackNet almost 6 yearsNever 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 almost 6 yearsIt doesn't even need a hardcoded date anyway, (Get-Date).AddMonths(-1) is the general answer.