How can I find out when Windows was last restarted?












101















How can I know when my computer running Windows 7 was last restarted?



I prefer a solution that doesn't involve searching the event log, but something like wmic or maybe cmd commands.










share|improve this question





























    101















    How can I know when my computer running Windows 7 was last restarted?



    I prefer a solution that doesn't involve searching the event log, but something like wmic or maybe cmd commands.










    share|improve this question



























      101












      101








      101


      33






      How can I know when my computer running Windows 7 was last restarted?



      I prefer a solution that doesn't involve searching the event log, but something like wmic or maybe cmd commands.










      share|improve this question
















      How can I know when my computer running Windows 7 was last restarted?



      I prefer a solution that doesn't involve searching the event log, but something like wmic or maybe cmd commands.







      windows-7 command-line wmic






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 24 '12 at 14:42









      slhck

      162k47449471




      162k47449471










      asked Dec 24 '12 at 14:24









      Royi NamirRoyi Namir

      2,158113459




      2,158113459






















          14 Answers
          14






          active

          oldest

          votes


















          162














          systeminfo command is almost right what you need. On English Windows 7 you can also do:



          systeminfo | find /i "Boot Time"


          Or with the help of WMIC:



          wmic os get lastbootuptime


          The main difference between Windows 7 and Windows XP that in Windows 7 Microsoft can show only last boot up time.





          Also in Task Manager:



          enter image description here






          share|improve this answer


























          • Also , is there any accumulative list of last resets ?

            – Royi Namir
            Dec 24 '12 at 14:40






          • 2





            @RoyiNamir: With some googling list of reboots (looks very similar): Get-EventLog -LogName System | where { ($_.InstanceId -bAnd 0xFFFF) -eq 6006 }

            – m0nhawk
            Dec 24 '12 at 15:08











          • it is powershell ..... ?

            – Royi Namir
            Dec 24 '12 at 15:10













          • You can also see the list in event viewer like so: howtogeek.com/72420/… I'm sure you can query this with PowerShell's Get-WinEvent but I haven't investigated that at all.

            – Bacon Bits
            Dec 24 '12 at 15:11






          • 1





            Be aware that systeminfo is localised. So "Boot Time" is only true for english versions of Windows.

            – Markus Mitterauer
            May 3 '17 at 8:33



















          23














          One other way to do this is to use the following command-line that works both in Windows XP and Windows 7:



          net statistics workstation


          It has the advantage of being faster than the systeminfo alternative while formatting the date (which wmic does not). You also get a few other informations that can be useful if you are actually using this command for debugging a computer (since you are asking specifically for cmd, I'm assuming you are not doing this programatically).



          You can find more informations on the net statistics command here: http://technet.microsoft.com/en-us/library/bb490714.aspx



          Here is an example of the result (using a French copy of Windows 7 Pro SP1 x64, user-language doesn't matter much for the command-line):



          example



          (the computer name is purposely blurred)





          More details on http://en.wikipedia.org/wiki/Uptime about the accuracy when determining system uptime.





          Important note: this method determines when the computer was last booted, not its uptime. The 2 numbers will be different if you use sleep/hibernate.






          share|improve this answer


























          • any idea why this doesn't read the same as using systeminfo or wmic... it's probably negligible, but it differs on my system by over 2 minutes

            – Anthony Shaw
            Dec 11 '14 at 20:31











          • It does differ for aobut 40 seconds on my computer too. I don't have any idea why it's not exactly the same, I guess the service just boots a little bit latter. Some interesting info on en.wikipedia.org/wiki/Uptime

            – dnLL
            Dec 11 '14 at 21:33






          • 2





            It differs by over nine months on mine :-) This is the only correct answer. It gives the actual datestamp of the last boot (or when whatever associated service started after bootup, so very close to it), whereas wmic, Task Manager, and systeminfo all seem to count backwards from the current time by the number of ticks the PC has been running. But if you put your computer to sleep (or hibernate) a lot, like I do, the actual total running time is much less than the time since the last boot (only thirty days in my case over the last several months), throwing off that calculation completely.

            – Cameron
            Feb 12 '16 at 6:05













          • Thank you @cameron, I added a note at the end of my answer. The original question was really about when the computer started and not its uptime, so that's an important detail. Wikipedia does somewhat mention the difference in the uptime article I linked.

            – dnLL
            Mar 10 '16 at 15:08











          • That isn't really the last "boot" time - it's the time that the Server or Workstation service started, depending which one you query stats for. Since these don't ever stop during a regular Windows session, it's a convenient approximation of last boot time.

            – oldmud0
            Jun 7 '17 at 15:50



















          18














          There's the LastBootUpTime property of the Win32_OperatingSystem class. You can use WMIC with this command:



          wmic os get lastbootuptime


          Or if you use Powershell, you can convert the time to something more readable than that annoying WMI datetime format:



          Get-WmiObject -class Win32_OperatingSystem | Select-Object  __SERVER,@{label='LastBootUpTime';expression={$_.ConvertToDateTime($_.LastBootUpTime)}}


          Note that in later versions of PowerShell, you can also use Get-CimInstance, which will automatically return the value as a datetime:



          Get-CimInstance -Class Win32_OperatingSystem | Select-Object LastBootUpTime


          The only irritating thing is that Get-CimInstance will sometimes change the name of some system fields from WMI objects, such as __SERVER here. You'd have to use either CSName or PSComputerName, which seems to work for me.






          share|improve this answer


























          • 20121217175810.414696+120 I think I need damn good calculator to calc time

            – Royi Namir
            Dec 24 '12 at 14:43






          • 7





            @Royi Yeah, WMI timestamps are stupid. It's a CIM_DATETIME, which is the format required by the standard. It's yyyymmddHHMMSS.mmmmmmsUUU, using 24 hour time. Here, your last reboot time is Dec 17, 2012 at 5:58 PM. msdn.microsoft.com/en-us/library/windows/desktop/…

            – Bacon Bits
            Dec 24 '12 at 14:53






          • 1





            Handy bonus of using the get-wmiobject method is it makes it trivial to get boot times of remote computers too. Just add "-computer <computername>" to the command (before the pipe)

            – camster342
            Oct 20 '13 at 22:22



















          8














          For Windows 10 users out there....



          System Properties Windows 10 - Performance Up time






          share|improve this answer





















          • 1





            This shows you the uptime (i.e. how long the system is running) not the time when the system has been started as OP asked.

            – Dawid Ferenczy
            May 3 '18 at 20:25






          • 1





            True, but this is still useful.

            – tbc0
            Jul 13 '18 at 17:29











          • Today my Windows 10 notebook is showing a bogus uptime. I shut it down last night, powered it on less than an hour ago, and Task Manager says it's been up for 5:19:40:10.

            – tbc0
            Oct 25 '18 at 14:15











          • Windows 10 does not actually shut down when shut down, I forget why exactly. However, if you want the uptime timer to reset you must restart.

            – Daniel Hayes
            Nov 1 '18 at 18:16



















          2














          On Windows 7 I prefer



          net statistics workstation


          WMIC doesn't take into account sleep time, and I leave my workstation locked up at work sleeping during the week, ready to wake up the next day.






          share|improve this answer































            2














            yet another way in a batch file to get boot time with wmic but in human readable form :




            for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
            set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
            echo DTS : %DTS%
            echo BOOTTIME :%BOOTTIME%



            output :



            DTS : 20170308073729.491206+060



            BOOTTIME : 2017-03-08 07:37






            share|improve this answer





















            • 1





              This answer would be better if it included an explanation of how the set BOOTTIME works.

              – a CVn
              Mar 28 '17 at 13:31





















            1














            On just about any version of windows you can check the timestamp on the swap file.



            dir /a:h c:pagefile.sys






            share|improve this answer



















            • 1





              I don't think so. At least on Windows 10, when I checked, the swap file time was newer than boot time.

              – tbc0
              Jul 13 '18 at 17:30



















            1














            From a similar ServerFault question, search/filter the Windows System Event Log for Event ID 6009.



            On Windows 10: Event Viewer > Windows Logs > System and then the Filter Current Log... Action.






            share|improve this answer































              1














              I want to add, that all these commands really give you the timestamps when a 'restart' or 'reboot' is done. And not when a shutdown and start is done. After shutdown and start the 'lastbootuptime' will reflect the time the system is really 'restarted' and not the actual boot up time.
              So shutdown/start gives the same result as coming back from suspend/hybernnate for the LastBootUpTime timestamp.






              share|improve this answer































                1














                To get it in PowerShell:



                Function Get-LastBoot {
                if ($Host.Version.Major -lt 3) {
                Get-WmiObject win32_operatingsystem | Select-Object CSname, @{n = 'LastBootUpTime'; e = {$_.ConverttoDateTime($_.lastbootuptime)}}
                }
                else {
                Get-CimInstance -ClassName win32_operatingsystem | Select-Object CSname, LastBootUpTime
                }
                }


                Here's the result:



                CSname  LastBootUpTime
                ------ --------------
                LAPTOP1 2018-09-07 08:57:02





                share|improve this answer































                  1














                  Please note that as pointed out by Alex the /sleepstudy command wasn't added until Windows 8.1. /systempowerreport might work instead.



                  Note that some of these other answers never worked for me, like searching the event-log for example was always missing some entries. @Florisz's answer is also correct in that regard. Here is my solution:



                  In an administrator cmd shell, run the following command:



                  powercfg /sleepstudy /output sleepstudy.html


                  Then open the file sleepstudy.html in a browser. You will be greeted with amazingly organized statistics about shutdown/reboot/standby/hibernation from the last three days. (so, run periodically if you need)



                  An example of an output: (AFAIR, Showdown (Hybrid) means fast startup)



                  enter image description here



                  Source / Documentation | Also related






                  share|improve this answer





















                  • 1





                    This is what I was looking for on Windows 10! I don't reboot, I normally shutdown. LastBootTime only refers to reboots on Windows 10.

                    – tbc0
                    Oct 25 '18 at 14:34



















                  0














                  You can use PowerShell for this.



                  Shutdown





                  Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 200 }


                  This will give you a list of logged shutdown times.



                  Alternative command, better optimized for remote connections:



                  Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 200; }


                  Example output:



                  TimeCreated                     Id LevelDisplayName Message
                  ----------- -- ---------------- -------
                  2017-01-28 18:25:46 200 Critical Windows has shutdown
                  2016-11-01 19:55:21 200 Error Windows has shutdown
                  2016-10-29 00:18:38 200 Critical Windows has shutdown
                  2016-10-26 23:16:55 200 Warning Windows has shutdown
                  2016-10-26 15:37:40 200 Warning Windows has shutdown
                  2016-10-26 02:18:24 200 Warning Windows has shutdown
                  2016-10-26 02:10:34 200 Warning Windows has shutdown
                  2016-10-26 02:04:01 200 Warning Windows has shutdown
                  2016-10-25 14:23:11 200 Warning Windows has shutdown
                  2016-10-25 13:07:46 200 Error Windows has shutdown
                  2016-10-25 00:18:12 200 Error Windows has shutdown
                  2016-10-19 13:16:39 200 Critical Windows has shutdown


                  Startup





                  The following command will give you a list of logged startup times.



                  Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 100}


                  Alternative command, better optimized for remote connections:



                  Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 100; }


                  Example output:



                  TimeCreated                     Id LevelDisplayName Message
                  ----------- -- ---------------- -------
                  2017-10-07 21:35:38 100 Critical Windows has started up
                  2017-01-28 18:25:48 100 Critical Windows has started up
                  2016-12-11 17:45:07 100 Critical Windows has started up
                  2016-11-16 13:26:52 100 Critical Windows has started up
                  2016-11-01 19:55:21 100 Critical Windows has started up
                  2016-10-29 00:18:39 100 Critical Windows has started up
                  2016-10-26 23:16:55 100 Error Windows has started up
                  2016-10-26 14:51:07 100 Error Windows has started up
                  2016-10-26 02:24:01 100 Error Windows has started up
                  2016-10-26 02:18:24 100 Critical Windows has started up
                  2016-10-26 02:10:34 100 Error Windows has started up
                  2016-10-26 02:04:01 100 Critical Windows has started up
                  2016-10-25 14:23:12 100 Error Windows has started up
                  2016-10-25 13:07:47 100 Error Windows has started up
                  2016-10-25 12:56:23 100 Error Windows has started up
                  2016-10-19 13:16:39 100 Critical Windows has started up


                  I have tested this on PowerShell 5.1 and Windows 10.0.15063. But it should work on Windows 7 as well, as long as you have at least PowerShell 3.0. Note that you need to run it as admin.



                  You will find the full documentation for the command here:
                  docs.microsoft.com






                  share|improve this answer


























                  • Didn't work for me on Windows 10. Not even as admin. See snag.gy/HcEn8j.jpg

                    – tbc0
                    Jul 13 '18 at 17:27





















                  0














                  A couple of answers mentions net statistics workstation and I've noted that both :



                  net statistics server


                  and



                  net statistics workstation


                  should provide data regarding last boot on the Statistics since ... line.



                  However, some OS versions (like Svr2008/6.0) will return 1/1/1980 12:00 for the date when using server. So I'll default to workstation.



                  Also you can abbreviate some of the command like net stats workstation and get the same results. Finally, if you jump around from system to system, the default CMD box isn't large enough to show all results from the command. So I'll pipe the output to more to avoid scrolling up to see the boot time. Therefore, my default command is:



                  net stats workstation | more


                  command






                  share|improve this answer

































                    0














                    Same as Max answer ...



                    for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                    set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                    echo DTS : %DTS%
                    echo BOOTTIME :%BOOTTIME%


                    ...but in oneliner:



                    for /f %a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%a && echo %DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%


                    This wmi implementation may appear a little messy but it's very fast compared to other powershell or systeminfo implementations and you can easily change the format since it's explicit in the code.



                    Thank you Max.






                    share|improve this answer























                      Your Answer








                      StackExchange.ready(function() {
                      var channelOptions = {
                      tags: "".split(" "),
                      id: "3"
                      };
                      initTagRenderer("".split(" "), "".split(" "), channelOptions);

                      StackExchange.using("externalEditor", function() {
                      // Have to fire editor after snippets, if snippets enabled
                      if (StackExchange.settings.snippets.snippetsEnabled) {
                      StackExchange.using("snippets", function() {
                      createEditor();
                      });
                      }
                      else {
                      createEditor();
                      }
                      });

                      function createEditor() {
                      StackExchange.prepareEditor({
                      heartbeatType: 'answer',
                      autoActivateHeartbeat: false,
                      convertImagesToLinks: true,
                      noModals: true,
                      showLowRepImageUploadWarning: true,
                      reputationToPostImages: 10,
                      bindNavPrevention: true,
                      postfix: "",
                      imageUploader: {
                      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                      allowUrls: true
                      },
                      onDemand: true,
                      discardSelector: ".discard-answer"
                      ,immediatelyShowMarkdownHelp:true
                      });


                      }
                      });














                      draft saved

                      draft discarded


















                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f523726%2fhow-can-i-find-out-when-windows-was-last-restarted%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown

























                      14 Answers
                      14






                      active

                      oldest

                      votes








                      14 Answers
                      14






                      active

                      oldest

                      votes









                      active

                      oldest

                      votes






                      active

                      oldest

                      votes









                      162














                      systeminfo command is almost right what you need. On English Windows 7 you can also do:



                      systeminfo | find /i "Boot Time"


                      Or with the help of WMIC:



                      wmic os get lastbootuptime


                      The main difference between Windows 7 and Windows XP that in Windows 7 Microsoft can show only last boot up time.





                      Also in Task Manager:



                      enter image description here






                      share|improve this answer


























                      • Also , is there any accumulative list of last resets ?

                        – Royi Namir
                        Dec 24 '12 at 14:40






                      • 2





                        @RoyiNamir: With some googling list of reboots (looks very similar): Get-EventLog -LogName System | where { ($_.InstanceId -bAnd 0xFFFF) -eq 6006 }

                        – m0nhawk
                        Dec 24 '12 at 15:08











                      • it is powershell ..... ?

                        – Royi Namir
                        Dec 24 '12 at 15:10













                      • You can also see the list in event viewer like so: howtogeek.com/72420/… I'm sure you can query this with PowerShell's Get-WinEvent but I haven't investigated that at all.

                        – Bacon Bits
                        Dec 24 '12 at 15:11






                      • 1





                        Be aware that systeminfo is localised. So "Boot Time" is only true for english versions of Windows.

                        – Markus Mitterauer
                        May 3 '17 at 8:33
















                      162














                      systeminfo command is almost right what you need. On English Windows 7 you can also do:



                      systeminfo | find /i "Boot Time"


                      Or with the help of WMIC:



                      wmic os get lastbootuptime


                      The main difference between Windows 7 and Windows XP that in Windows 7 Microsoft can show only last boot up time.





                      Also in Task Manager:



                      enter image description here






                      share|improve this answer


























                      • Also , is there any accumulative list of last resets ?

                        – Royi Namir
                        Dec 24 '12 at 14:40






                      • 2





                        @RoyiNamir: With some googling list of reboots (looks very similar): Get-EventLog -LogName System | where { ($_.InstanceId -bAnd 0xFFFF) -eq 6006 }

                        – m0nhawk
                        Dec 24 '12 at 15:08











                      • it is powershell ..... ?

                        – Royi Namir
                        Dec 24 '12 at 15:10













                      • You can also see the list in event viewer like so: howtogeek.com/72420/… I'm sure you can query this with PowerShell's Get-WinEvent but I haven't investigated that at all.

                        – Bacon Bits
                        Dec 24 '12 at 15:11






                      • 1





                        Be aware that systeminfo is localised. So "Boot Time" is only true for english versions of Windows.

                        – Markus Mitterauer
                        May 3 '17 at 8:33














                      162












                      162








                      162







                      systeminfo command is almost right what you need. On English Windows 7 you can also do:



                      systeminfo | find /i "Boot Time"


                      Or with the help of WMIC:



                      wmic os get lastbootuptime


                      The main difference between Windows 7 and Windows XP that in Windows 7 Microsoft can show only last boot up time.





                      Also in Task Manager:



                      enter image description here






                      share|improve this answer















                      systeminfo command is almost right what you need. On English Windows 7 you can also do:



                      systeminfo | find /i "Boot Time"


                      Or with the help of WMIC:



                      wmic os get lastbootuptime


                      The main difference between Windows 7 and Windows XP that in Windows 7 Microsoft can show only last boot up time.





                      Also in Task Manager:



                      enter image description here







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Dec 24 '12 at 14:44

























                      answered Dec 24 '12 at 14:32









                      m0nhawkm0nhawk

                      2,40721623




                      2,40721623













                      • Also , is there any accumulative list of last resets ?

                        – Royi Namir
                        Dec 24 '12 at 14:40






                      • 2





                        @RoyiNamir: With some googling list of reboots (looks very similar): Get-EventLog -LogName System | where { ($_.InstanceId -bAnd 0xFFFF) -eq 6006 }

                        – m0nhawk
                        Dec 24 '12 at 15:08











                      • it is powershell ..... ?

                        – Royi Namir
                        Dec 24 '12 at 15:10













                      • You can also see the list in event viewer like so: howtogeek.com/72420/… I'm sure you can query this with PowerShell's Get-WinEvent but I haven't investigated that at all.

                        – Bacon Bits
                        Dec 24 '12 at 15:11






                      • 1





                        Be aware that systeminfo is localised. So "Boot Time" is only true for english versions of Windows.

                        – Markus Mitterauer
                        May 3 '17 at 8:33



















                      • Also , is there any accumulative list of last resets ?

                        – Royi Namir
                        Dec 24 '12 at 14:40






                      • 2





                        @RoyiNamir: With some googling list of reboots (looks very similar): Get-EventLog -LogName System | where { ($_.InstanceId -bAnd 0xFFFF) -eq 6006 }

                        – m0nhawk
                        Dec 24 '12 at 15:08











                      • it is powershell ..... ?

                        – Royi Namir
                        Dec 24 '12 at 15:10













                      • You can also see the list in event viewer like so: howtogeek.com/72420/… I'm sure you can query this with PowerShell's Get-WinEvent but I haven't investigated that at all.

                        – Bacon Bits
                        Dec 24 '12 at 15:11






                      • 1





                        Be aware that systeminfo is localised. So "Boot Time" is only true for english versions of Windows.

                        – Markus Mitterauer
                        May 3 '17 at 8:33

















                      Also , is there any accumulative list of last resets ?

                      – Royi Namir
                      Dec 24 '12 at 14:40





                      Also , is there any accumulative list of last resets ?

                      – Royi Namir
                      Dec 24 '12 at 14:40




                      2




                      2





                      @RoyiNamir: With some googling list of reboots (looks very similar): Get-EventLog -LogName System | where { ($_.InstanceId -bAnd 0xFFFF) -eq 6006 }

                      – m0nhawk
                      Dec 24 '12 at 15:08





                      @RoyiNamir: With some googling list of reboots (looks very similar): Get-EventLog -LogName System | where { ($_.InstanceId -bAnd 0xFFFF) -eq 6006 }

                      – m0nhawk
                      Dec 24 '12 at 15:08













                      it is powershell ..... ?

                      – Royi Namir
                      Dec 24 '12 at 15:10







                      it is powershell ..... ?

                      – Royi Namir
                      Dec 24 '12 at 15:10















                      You can also see the list in event viewer like so: howtogeek.com/72420/… I'm sure you can query this with PowerShell's Get-WinEvent but I haven't investigated that at all.

                      – Bacon Bits
                      Dec 24 '12 at 15:11





                      You can also see the list in event viewer like so: howtogeek.com/72420/… I'm sure you can query this with PowerShell's Get-WinEvent but I haven't investigated that at all.

                      – Bacon Bits
                      Dec 24 '12 at 15:11




                      1




                      1





                      Be aware that systeminfo is localised. So "Boot Time" is only true for english versions of Windows.

                      – Markus Mitterauer
                      May 3 '17 at 8:33





                      Be aware that systeminfo is localised. So "Boot Time" is only true for english versions of Windows.

                      – Markus Mitterauer
                      May 3 '17 at 8:33













                      23














                      One other way to do this is to use the following command-line that works both in Windows XP and Windows 7:



                      net statistics workstation


                      It has the advantage of being faster than the systeminfo alternative while formatting the date (which wmic does not). You also get a few other informations that can be useful if you are actually using this command for debugging a computer (since you are asking specifically for cmd, I'm assuming you are not doing this programatically).



                      You can find more informations on the net statistics command here: http://technet.microsoft.com/en-us/library/bb490714.aspx



                      Here is an example of the result (using a French copy of Windows 7 Pro SP1 x64, user-language doesn't matter much for the command-line):



                      example



                      (the computer name is purposely blurred)





                      More details on http://en.wikipedia.org/wiki/Uptime about the accuracy when determining system uptime.





                      Important note: this method determines when the computer was last booted, not its uptime. The 2 numbers will be different if you use sleep/hibernate.






                      share|improve this answer


























                      • any idea why this doesn't read the same as using systeminfo or wmic... it's probably negligible, but it differs on my system by over 2 minutes

                        – Anthony Shaw
                        Dec 11 '14 at 20:31











                      • It does differ for aobut 40 seconds on my computer too. I don't have any idea why it's not exactly the same, I guess the service just boots a little bit latter. Some interesting info on en.wikipedia.org/wiki/Uptime

                        – dnLL
                        Dec 11 '14 at 21:33






                      • 2





                        It differs by over nine months on mine :-) This is the only correct answer. It gives the actual datestamp of the last boot (or when whatever associated service started after bootup, so very close to it), whereas wmic, Task Manager, and systeminfo all seem to count backwards from the current time by the number of ticks the PC has been running. But if you put your computer to sleep (or hibernate) a lot, like I do, the actual total running time is much less than the time since the last boot (only thirty days in my case over the last several months), throwing off that calculation completely.

                        – Cameron
                        Feb 12 '16 at 6:05













                      • Thank you @cameron, I added a note at the end of my answer. The original question was really about when the computer started and not its uptime, so that's an important detail. Wikipedia does somewhat mention the difference in the uptime article I linked.

                        – dnLL
                        Mar 10 '16 at 15:08











                      • That isn't really the last "boot" time - it's the time that the Server or Workstation service started, depending which one you query stats for. Since these don't ever stop during a regular Windows session, it's a convenient approximation of last boot time.

                        – oldmud0
                        Jun 7 '17 at 15:50
















                      23














                      One other way to do this is to use the following command-line that works both in Windows XP and Windows 7:



                      net statistics workstation


                      It has the advantage of being faster than the systeminfo alternative while formatting the date (which wmic does not). You also get a few other informations that can be useful if you are actually using this command for debugging a computer (since you are asking specifically for cmd, I'm assuming you are not doing this programatically).



                      You can find more informations on the net statistics command here: http://technet.microsoft.com/en-us/library/bb490714.aspx



                      Here is an example of the result (using a French copy of Windows 7 Pro SP1 x64, user-language doesn't matter much for the command-line):



                      example



                      (the computer name is purposely blurred)





                      More details on http://en.wikipedia.org/wiki/Uptime about the accuracy when determining system uptime.





                      Important note: this method determines when the computer was last booted, not its uptime. The 2 numbers will be different if you use sleep/hibernate.






                      share|improve this answer


























                      • any idea why this doesn't read the same as using systeminfo or wmic... it's probably negligible, but it differs on my system by over 2 minutes

                        – Anthony Shaw
                        Dec 11 '14 at 20:31











                      • It does differ for aobut 40 seconds on my computer too. I don't have any idea why it's not exactly the same, I guess the service just boots a little bit latter. Some interesting info on en.wikipedia.org/wiki/Uptime

                        – dnLL
                        Dec 11 '14 at 21:33






                      • 2





                        It differs by over nine months on mine :-) This is the only correct answer. It gives the actual datestamp of the last boot (or when whatever associated service started after bootup, so very close to it), whereas wmic, Task Manager, and systeminfo all seem to count backwards from the current time by the number of ticks the PC has been running. But if you put your computer to sleep (or hibernate) a lot, like I do, the actual total running time is much less than the time since the last boot (only thirty days in my case over the last several months), throwing off that calculation completely.

                        – Cameron
                        Feb 12 '16 at 6:05













                      • Thank you @cameron, I added a note at the end of my answer. The original question was really about when the computer started and not its uptime, so that's an important detail. Wikipedia does somewhat mention the difference in the uptime article I linked.

                        – dnLL
                        Mar 10 '16 at 15:08











                      • That isn't really the last "boot" time - it's the time that the Server or Workstation service started, depending which one you query stats for. Since these don't ever stop during a regular Windows session, it's a convenient approximation of last boot time.

                        – oldmud0
                        Jun 7 '17 at 15:50














                      23












                      23








                      23







                      One other way to do this is to use the following command-line that works both in Windows XP and Windows 7:



                      net statistics workstation


                      It has the advantage of being faster than the systeminfo alternative while formatting the date (which wmic does not). You also get a few other informations that can be useful if you are actually using this command for debugging a computer (since you are asking specifically for cmd, I'm assuming you are not doing this programatically).



                      You can find more informations on the net statistics command here: http://technet.microsoft.com/en-us/library/bb490714.aspx



                      Here is an example of the result (using a French copy of Windows 7 Pro SP1 x64, user-language doesn't matter much for the command-line):



                      example



                      (the computer name is purposely blurred)





                      More details on http://en.wikipedia.org/wiki/Uptime about the accuracy when determining system uptime.





                      Important note: this method determines when the computer was last booted, not its uptime. The 2 numbers will be different if you use sleep/hibernate.






                      share|improve this answer















                      One other way to do this is to use the following command-line that works both in Windows XP and Windows 7:



                      net statistics workstation


                      It has the advantage of being faster than the systeminfo alternative while formatting the date (which wmic does not). You also get a few other informations that can be useful if you are actually using this command for debugging a computer (since you are asking specifically for cmd, I'm assuming you are not doing this programatically).



                      You can find more informations on the net statistics command here: http://technet.microsoft.com/en-us/library/bb490714.aspx



                      Here is an example of the result (using a French copy of Windows 7 Pro SP1 x64, user-language doesn't matter much for the command-line):



                      example



                      (the computer name is purposely blurred)





                      More details on http://en.wikipedia.org/wiki/Uptime about the accuracy when determining system uptime.





                      Important note: this method determines when the computer was last booted, not its uptime. The 2 numbers will be different if you use sleep/hibernate.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Mar 10 '16 at 15:06

























                      answered Dec 9 '14 at 15:34









                      dnLLdnLL

                      284415




                      284415













                      • any idea why this doesn't read the same as using systeminfo or wmic... it's probably negligible, but it differs on my system by over 2 minutes

                        – Anthony Shaw
                        Dec 11 '14 at 20:31











                      • It does differ for aobut 40 seconds on my computer too. I don't have any idea why it's not exactly the same, I guess the service just boots a little bit latter. Some interesting info on en.wikipedia.org/wiki/Uptime

                        – dnLL
                        Dec 11 '14 at 21:33






                      • 2





                        It differs by over nine months on mine :-) This is the only correct answer. It gives the actual datestamp of the last boot (or when whatever associated service started after bootup, so very close to it), whereas wmic, Task Manager, and systeminfo all seem to count backwards from the current time by the number of ticks the PC has been running. But if you put your computer to sleep (or hibernate) a lot, like I do, the actual total running time is much less than the time since the last boot (only thirty days in my case over the last several months), throwing off that calculation completely.

                        – Cameron
                        Feb 12 '16 at 6:05













                      • Thank you @cameron, I added a note at the end of my answer. The original question was really about when the computer started and not its uptime, so that's an important detail. Wikipedia does somewhat mention the difference in the uptime article I linked.

                        – dnLL
                        Mar 10 '16 at 15:08











                      • That isn't really the last "boot" time - it's the time that the Server or Workstation service started, depending which one you query stats for. Since these don't ever stop during a regular Windows session, it's a convenient approximation of last boot time.

                        – oldmud0
                        Jun 7 '17 at 15:50



















                      • any idea why this doesn't read the same as using systeminfo or wmic... it's probably negligible, but it differs on my system by over 2 minutes

                        – Anthony Shaw
                        Dec 11 '14 at 20:31











                      • It does differ for aobut 40 seconds on my computer too. I don't have any idea why it's not exactly the same, I guess the service just boots a little bit latter. Some interesting info on en.wikipedia.org/wiki/Uptime

                        – dnLL
                        Dec 11 '14 at 21:33






                      • 2





                        It differs by over nine months on mine :-) This is the only correct answer. It gives the actual datestamp of the last boot (or when whatever associated service started after bootup, so very close to it), whereas wmic, Task Manager, and systeminfo all seem to count backwards from the current time by the number of ticks the PC has been running. But if you put your computer to sleep (or hibernate) a lot, like I do, the actual total running time is much less than the time since the last boot (only thirty days in my case over the last several months), throwing off that calculation completely.

                        – Cameron
                        Feb 12 '16 at 6:05













                      • Thank you @cameron, I added a note at the end of my answer. The original question was really about when the computer started and not its uptime, so that's an important detail. Wikipedia does somewhat mention the difference in the uptime article I linked.

                        – dnLL
                        Mar 10 '16 at 15:08











                      • That isn't really the last "boot" time - it's the time that the Server or Workstation service started, depending which one you query stats for. Since these don't ever stop during a regular Windows session, it's a convenient approximation of last boot time.

                        – oldmud0
                        Jun 7 '17 at 15:50

















                      any idea why this doesn't read the same as using systeminfo or wmic... it's probably negligible, but it differs on my system by over 2 minutes

                      – Anthony Shaw
                      Dec 11 '14 at 20:31





                      any idea why this doesn't read the same as using systeminfo or wmic... it's probably negligible, but it differs on my system by over 2 minutes

                      – Anthony Shaw
                      Dec 11 '14 at 20:31













                      It does differ for aobut 40 seconds on my computer too. I don't have any idea why it's not exactly the same, I guess the service just boots a little bit latter. Some interesting info on en.wikipedia.org/wiki/Uptime

                      – dnLL
                      Dec 11 '14 at 21:33





                      It does differ for aobut 40 seconds on my computer too. I don't have any idea why it's not exactly the same, I guess the service just boots a little bit latter. Some interesting info on en.wikipedia.org/wiki/Uptime

                      – dnLL
                      Dec 11 '14 at 21:33




                      2




                      2





                      It differs by over nine months on mine :-) This is the only correct answer. It gives the actual datestamp of the last boot (or when whatever associated service started after bootup, so very close to it), whereas wmic, Task Manager, and systeminfo all seem to count backwards from the current time by the number of ticks the PC has been running. But if you put your computer to sleep (or hibernate) a lot, like I do, the actual total running time is much less than the time since the last boot (only thirty days in my case over the last several months), throwing off that calculation completely.

                      – Cameron
                      Feb 12 '16 at 6:05







                      It differs by over nine months on mine :-) This is the only correct answer. It gives the actual datestamp of the last boot (or when whatever associated service started after bootup, so very close to it), whereas wmic, Task Manager, and systeminfo all seem to count backwards from the current time by the number of ticks the PC has been running. But if you put your computer to sleep (or hibernate) a lot, like I do, the actual total running time is much less than the time since the last boot (only thirty days in my case over the last several months), throwing off that calculation completely.

                      – Cameron
                      Feb 12 '16 at 6:05















                      Thank you @cameron, I added a note at the end of my answer. The original question was really about when the computer started and not its uptime, so that's an important detail. Wikipedia does somewhat mention the difference in the uptime article I linked.

                      – dnLL
                      Mar 10 '16 at 15:08





                      Thank you @cameron, I added a note at the end of my answer. The original question was really about when the computer started and not its uptime, so that's an important detail. Wikipedia does somewhat mention the difference in the uptime article I linked.

                      – dnLL
                      Mar 10 '16 at 15:08













                      That isn't really the last "boot" time - it's the time that the Server or Workstation service started, depending which one you query stats for. Since these don't ever stop during a regular Windows session, it's a convenient approximation of last boot time.

                      – oldmud0
                      Jun 7 '17 at 15:50





                      That isn't really the last "boot" time - it's the time that the Server or Workstation service started, depending which one you query stats for. Since these don't ever stop during a regular Windows session, it's a convenient approximation of last boot time.

                      – oldmud0
                      Jun 7 '17 at 15:50











                      18














                      There's the LastBootUpTime property of the Win32_OperatingSystem class. You can use WMIC with this command:



                      wmic os get lastbootuptime


                      Or if you use Powershell, you can convert the time to something more readable than that annoying WMI datetime format:



                      Get-WmiObject -class Win32_OperatingSystem | Select-Object  __SERVER,@{label='LastBootUpTime';expression={$_.ConvertToDateTime($_.LastBootUpTime)}}


                      Note that in later versions of PowerShell, you can also use Get-CimInstance, which will automatically return the value as a datetime:



                      Get-CimInstance -Class Win32_OperatingSystem | Select-Object LastBootUpTime


                      The only irritating thing is that Get-CimInstance will sometimes change the name of some system fields from WMI objects, such as __SERVER here. You'd have to use either CSName or PSComputerName, which seems to work for me.






                      share|improve this answer


























                      • 20121217175810.414696+120 I think I need damn good calculator to calc time

                        – Royi Namir
                        Dec 24 '12 at 14:43






                      • 7





                        @Royi Yeah, WMI timestamps are stupid. It's a CIM_DATETIME, which is the format required by the standard. It's yyyymmddHHMMSS.mmmmmmsUUU, using 24 hour time. Here, your last reboot time is Dec 17, 2012 at 5:58 PM. msdn.microsoft.com/en-us/library/windows/desktop/…

                        – Bacon Bits
                        Dec 24 '12 at 14:53






                      • 1





                        Handy bonus of using the get-wmiobject method is it makes it trivial to get boot times of remote computers too. Just add "-computer <computername>" to the command (before the pipe)

                        – camster342
                        Oct 20 '13 at 22:22
















                      18














                      There's the LastBootUpTime property of the Win32_OperatingSystem class. You can use WMIC with this command:



                      wmic os get lastbootuptime


                      Or if you use Powershell, you can convert the time to something more readable than that annoying WMI datetime format:



                      Get-WmiObject -class Win32_OperatingSystem | Select-Object  __SERVER,@{label='LastBootUpTime';expression={$_.ConvertToDateTime($_.LastBootUpTime)}}


                      Note that in later versions of PowerShell, you can also use Get-CimInstance, which will automatically return the value as a datetime:



                      Get-CimInstance -Class Win32_OperatingSystem | Select-Object LastBootUpTime


                      The only irritating thing is that Get-CimInstance will sometimes change the name of some system fields from WMI objects, such as __SERVER here. You'd have to use either CSName or PSComputerName, which seems to work for me.






                      share|improve this answer


























                      • 20121217175810.414696+120 I think I need damn good calculator to calc time

                        – Royi Namir
                        Dec 24 '12 at 14:43






                      • 7





                        @Royi Yeah, WMI timestamps are stupid. It's a CIM_DATETIME, which is the format required by the standard. It's yyyymmddHHMMSS.mmmmmmsUUU, using 24 hour time. Here, your last reboot time is Dec 17, 2012 at 5:58 PM. msdn.microsoft.com/en-us/library/windows/desktop/…

                        – Bacon Bits
                        Dec 24 '12 at 14:53






                      • 1





                        Handy bonus of using the get-wmiobject method is it makes it trivial to get boot times of remote computers too. Just add "-computer <computername>" to the command (before the pipe)

                        – camster342
                        Oct 20 '13 at 22:22














                      18












                      18








                      18







                      There's the LastBootUpTime property of the Win32_OperatingSystem class. You can use WMIC with this command:



                      wmic os get lastbootuptime


                      Or if you use Powershell, you can convert the time to something more readable than that annoying WMI datetime format:



                      Get-WmiObject -class Win32_OperatingSystem | Select-Object  __SERVER,@{label='LastBootUpTime';expression={$_.ConvertToDateTime($_.LastBootUpTime)}}


                      Note that in later versions of PowerShell, you can also use Get-CimInstance, which will automatically return the value as a datetime:



                      Get-CimInstance -Class Win32_OperatingSystem | Select-Object LastBootUpTime


                      The only irritating thing is that Get-CimInstance will sometimes change the name of some system fields from WMI objects, such as __SERVER here. You'd have to use either CSName or PSComputerName, which seems to work for me.






                      share|improve this answer















                      There's the LastBootUpTime property of the Win32_OperatingSystem class. You can use WMIC with this command:



                      wmic os get lastbootuptime


                      Or if you use Powershell, you can convert the time to something more readable than that annoying WMI datetime format:



                      Get-WmiObject -class Win32_OperatingSystem | Select-Object  __SERVER,@{label='LastBootUpTime';expression={$_.ConvertToDateTime($_.LastBootUpTime)}}


                      Note that in later versions of PowerShell, you can also use Get-CimInstance, which will automatically return the value as a datetime:



                      Get-CimInstance -Class Win32_OperatingSystem | Select-Object LastBootUpTime


                      The only irritating thing is that Get-CimInstance will sometimes change the name of some system fields from WMI objects, such as __SERVER here. You'd have to use either CSName or PSComputerName, which seems to work for me.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Feb 24 '18 at 21:30









                      Chin

                      4,162205687




                      4,162205687










                      answered Dec 24 '12 at 14:41









                      Bacon BitsBacon Bits

                      5,95511618




                      5,95511618













                      • 20121217175810.414696+120 I think I need damn good calculator to calc time

                        – Royi Namir
                        Dec 24 '12 at 14:43






                      • 7





                        @Royi Yeah, WMI timestamps are stupid. It's a CIM_DATETIME, which is the format required by the standard. It's yyyymmddHHMMSS.mmmmmmsUUU, using 24 hour time. Here, your last reboot time is Dec 17, 2012 at 5:58 PM. msdn.microsoft.com/en-us/library/windows/desktop/…

                        – Bacon Bits
                        Dec 24 '12 at 14:53






                      • 1





                        Handy bonus of using the get-wmiobject method is it makes it trivial to get boot times of remote computers too. Just add "-computer <computername>" to the command (before the pipe)

                        – camster342
                        Oct 20 '13 at 22:22



















                      • 20121217175810.414696+120 I think I need damn good calculator to calc time

                        – Royi Namir
                        Dec 24 '12 at 14:43






                      • 7





                        @Royi Yeah, WMI timestamps are stupid. It's a CIM_DATETIME, which is the format required by the standard. It's yyyymmddHHMMSS.mmmmmmsUUU, using 24 hour time. Here, your last reboot time is Dec 17, 2012 at 5:58 PM. msdn.microsoft.com/en-us/library/windows/desktop/…

                        – Bacon Bits
                        Dec 24 '12 at 14:53






                      • 1





                        Handy bonus of using the get-wmiobject method is it makes it trivial to get boot times of remote computers too. Just add "-computer <computername>" to the command (before the pipe)

                        – camster342
                        Oct 20 '13 at 22:22

















                      20121217175810.414696+120 I think I need damn good calculator to calc time

                      – Royi Namir
                      Dec 24 '12 at 14:43





                      20121217175810.414696+120 I think I need damn good calculator to calc time

                      – Royi Namir
                      Dec 24 '12 at 14:43




                      7




                      7





                      @Royi Yeah, WMI timestamps are stupid. It's a CIM_DATETIME, which is the format required by the standard. It's yyyymmddHHMMSS.mmmmmmsUUU, using 24 hour time. Here, your last reboot time is Dec 17, 2012 at 5:58 PM. msdn.microsoft.com/en-us/library/windows/desktop/…

                      – Bacon Bits
                      Dec 24 '12 at 14:53





                      @Royi Yeah, WMI timestamps are stupid. It's a CIM_DATETIME, which is the format required by the standard. It's yyyymmddHHMMSS.mmmmmmsUUU, using 24 hour time. Here, your last reboot time is Dec 17, 2012 at 5:58 PM. msdn.microsoft.com/en-us/library/windows/desktop/…

                      – Bacon Bits
                      Dec 24 '12 at 14:53




                      1




                      1





                      Handy bonus of using the get-wmiobject method is it makes it trivial to get boot times of remote computers too. Just add "-computer <computername>" to the command (before the pipe)

                      – camster342
                      Oct 20 '13 at 22:22





                      Handy bonus of using the get-wmiobject method is it makes it trivial to get boot times of remote computers too. Just add "-computer <computername>" to the command (before the pipe)

                      – camster342
                      Oct 20 '13 at 22:22











                      8














                      For Windows 10 users out there....



                      System Properties Windows 10 - Performance Up time






                      share|improve this answer





















                      • 1





                        This shows you the uptime (i.e. how long the system is running) not the time when the system has been started as OP asked.

                        – Dawid Ferenczy
                        May 3 '18 at 20:25






                      • 1





                        True, but this is still useful.

                        – tbc0
                        Jul 13 '18 at 17:29











                      • Today my Windows 10 notebook is showing a bogus uptime. I shut it down last night, powered it on less than an hour ago, and Task Manager says it's been up for 5:19:40:10.

                        – tbc0
                        Oct 25 '18 at 14:15











                      • Windows 10 does not actually shut down when shut down, I forget why exactly. However, if you want the uptime timer to reset you must restart.

                        – Daniel Hayes
                        Nov 1 '18 at 18:16
















                      8














                      For Windows 10 users out there....



                      System Properties Windows 10 - Performance Up time






                      share|improve this answer





















                      • 1





                        This shows you the uptime (i.e. how long the system is running) not the time when the system has been started as OP asked.

                        – Dawid Ferenczy
                        May 3 '18 at 20:25






                      • 1





                        True, but this is still useful.

                        – tbc0
                        Jul 13 '18 at 17:29











                      • Today my Windows 10 notebook is showing a bogus uptime. I shut it down last night, powered it on less than an hour ago, and Task Manager says it's been up for 5:19:40:10.

                        – tbc0
                        Oct 25 '18 at 14:15











                      • Windows 10 does not actually shut down when shut down, I forget why exactly. However, if you want the uptime timer to reset you must restart.

                        – Daniel Hayes
                        Nov 1 '18 at 18:16














                      8












                      8








                      8







                      For Windows 10 users out there....



                      System Properties Windows 10 - Performance Up time






                      share|improve this answer















                      For Windows 10 users out there....



                      System Properties Windows 10 - Performance Up time







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Mar 28 '17 at 13:30









                      a CVn

                      24.5k973120




                      24.5k973120










                      answered Mar 28 '17 at 13:19









                      Jonathan TepperJonathan Tepper

                      8111




                      8111








                      • 1





                        This shows you the uptime (i.e. how long the system is running) not the time when the system has been started as OP asked.

                        – Dawid Ferenczy
                        May 3 '18 at 20:25






                      • 1





                        True, but this is still useful.

                        – tbc0
                        Jul 13 '18 at 17:29











                      • Today my Windows 10 notebook is showing a bogus uptime. I shut it down last night, powered it on less than an hour ago, and Task Manager says it's been up for 5:19:40:10.

                        – tbc0
                        Oct 25 '18 at 14:15











                      • Windows 10 does not actually shut down when shut down, I forget why exactly. However, if you want the uptime timer to reset you must restart.

                        – Daniel Hayes
                        Nov 1 '18 at 18:16














                      • 1





                        This shows you the uptime (i.e. how long the system is running) not the time when the system has been started as OP asked.

                        – Dawid Ferenczy
                        May 3 '18 at 20:25






                      • 1





                        True, but this is still useful.

                        – tbc0
                        Jul 13 '18 at 17:29











                      • Today my Windows 10 notebook is showing a bogus uptime. I shut it down last night, powered it on less than an hour ago, and Task Manager says it's been up for 5:19:40:10.

                        – tbc0
                        Oct 25 '18 at 14:15











                      • Windows 10 does not actually shut down when shut down, I forget why exactly. However, if you want the uptime timer to reset you must restart.

                        – Daniel Hayes
                        Nov 1 '18 at 18:16








                      1




                      1





                      This shows you the uptime (i.e. how long the system is running) not the time when the system has been started as OP asked.

                      – Dawid Ferenczy
                      May 3 '18 at 20:25





                      This shows you the uptime (i.e. how long the system is running) not the time when the system has been started as OP asked.

                      – Dawid Ferenczy
                      May 3 '18 at 20:25




                      1




                      1





                      True, but this is still useful.

                      – tbc0
                      Jul 13 '18 at 17:29





                      True, but this is still useful.

                      – tbc0
                      Jul 13 '18 at 17:29













                      Today my Windows 10 notebook is showing a bogus uptime. I shut it down last night, powered it on less than an hour ago, and Task Manager says it's been up for 5:19:40:10.

                      – tbc0
                      Oct 25 '18 at 14:15





                      Today my Windows 10 notebook is showing a bogus uptime. I shut it down last night, powered it on less than an hour ago, and Task Manager says it's been up for 5:19:40:10.

                      – tbc0
                      Oct 25 '18 at 14:15













                      Windows 10 does not actually shut down when shut down, I forget why exactly. However, if you want the uptime timer to reset you must restart.

                      – Daniel Hayes
                      Nov 1 '18 at 18:16





                      Windows 10 does not actually shut down when shut down, I forget why exactly. However, if you want the uptime timer to reset you must restart.

                      – Daniel Hayes
                      Nov 1 '18 at 18:16











                      2














                      On Windows 7 I prefer



                      net statistics workstation


                      WMIC doesn't take into account sleep time, and I leave my workstation locked up at work sleeping during the week, ready to wake up the next day.






                      share|improve this answer




























                        2














                        On Windows 7 I prefer



                        net statistics workstation


                        WMIC doesn't take into account sleep time, and I leave my workstation locked up at work sleeping during the week, ready to wake up the next day.






                        share|improve this answer


























                          2












                          2








                          2







                          On Windows 7 I prefer



                          net statistics workstation


                          WMIC doesn't take into account sleep time, and I leave my workstation locked up at work sleeping during the week, ready to wake up the next day.






                          share|improve this answer













                          On Windows 7 I prefer



                          net statistics workstation


                          WMIC doesn't take into account sleep time, and I leave my workstation locked up at work sleeping during the week, ready to wake up the next day.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 8 '15 at 20:41









                          tbc0tbc0

                          234313




                          234313























                              2














                              yet another way in a batch file to get boot time with wmic but in human readable form :




                              for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                              set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                              echo DTS : %DTS%
                              echo BOOTTIME :%BOOTTIME%



                              output :



                              DTS : 20170308073729.491206+060



                              BOOTTIME : 2017-03-08 07:37






                              share|improve this answer





















                              • 1





                                This answer would be better if it included an explanation of how the set BOOTTIME works.

                                – a CVn
                                Mar 28 '17 at 13:31


















                              2














                              yet another way in a batch file to get boot time with wmic but in human readable form :




                              for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                              set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                              echo DTS : %DTS%
                              echo BOOTTIME :%BOOTTIME%



                              output :



                              DTS : 20170308073729.491206+060



                              BOOTTIME : 2017-03-08 07:37






                              share|improve this answer





















                              • 1





                                This answer would be better if it included an explanation of how the set BOOTTIME works.

                                – a CVn
                                Mar 28 '17 at 13:31
















                              2












                              2








                              2







                              yet another way in a batch file to get boot time with wmic but in human readable form :




                              for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                              set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                              echo DTS : %DTS%
                              echo BOOTTIME :%BOOTTIME%



                              output :



                              DTS : 20170308073729.491206+060



                              BOOTTIME : 2017-03-08 07:37






                              share|improve this answer















                              yet another way in a batch file to get boot time with wmic but in human readable form :




                              for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                              set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                              echo DTS : %DTS%
                              echo BOOTTIME :%BOOTTIME%



                              output :



                              DTS : 20170308073729.491206+060



                              BOOTTIME : 2017-03-08 07:37







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Apr 5 '17 at 10:39

























                              answered May 24 '16 at 20:46









                              MaxMax

                              1365




                              1365








                              • 1





                                This answer would be better if it included an explanation of how the set BOOTTIME works.

                                – a CVn
                                Mar 28 '17 at 13:31
















                              • 1





                                This answer would be better if it included an explanation of how the set BOOTTIME works.

                                – a CVn
                                Mar 28 '17 at 13:31










                              1




                              1





                              This answer would be better if it included an explanation of how the set BOOTTIME works.

                              – a CVn
                              Mar 28 '17 at 13:31







                              This answer would be better if it included an explanation of how the set BOOTTIME works.

                              – a CVn
                              Mar 28 '17 at 13:31













                              1














                              On just about any version of windows you can check the timestamp on the swap file.



                              dir /a:h c:pagefile.sys






                              share|improve this answer



















                              • 1





                                I don't think so. At least on Windows 10, when I checked, the swap file time was newer than boot time.

                                – tbc0
                                Jul 13 '18 at 17:30
















                              1














                              On just about any version of windows you can check the timestamp on the swap file.



                              dir /a:h c:pagefile.sys






                              share|improve this answer



















                              • 1





                                I don't think so. At least on Windows 10, when I checked, the swap file time was newer than boot time.

                                – tbc0
                                Jul 13 '18 at 17:30














                              1












                              1








                              1







                              On just about any version of windows you can check the timestamp on the swap file.



                              dir /a:h c:pagefile.sys






                              share|improve this answer













                              On just about any version of windows you can check the timestamp on the swap file.



                              dir /a:h c:pagefile.sys







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jul 25 '16 at 15:12









                              ChuckChuck

                              1313




                              1313








                              • 1





                                I don't think so. At least on Windows 10, when I checked, the swap file time was newer than boot time.

                                – tbc0
                                Jul 13 '18 at 17:30














                              • 1





                                I don't think so. At least on Windows 10, when I checked, the swap file time was newer than boot time.

                                – tbc0
                                Jul 13 '18 at 17:30








                              1




                              1





                              I don't think so. At least on Windows 10, when I checked, the swap file time was newer than boot time.

                              – tbc0
                              Jul 13 '18 at 17:30





                              I don't think so. At least on Windows 10, when I checked, the swap file time was newer than boot time.

                              – tbc0
                              Jul 13 '18 at 17:30











                              1














                              From a similar ServerFault question, search/filter the Windows System Event Log for Event ID 6009.



                              On Windows 10: Event Viewer > Windows Logs > System and then the Filter Current Log... Action.






                              share|improve this answer




























                                1














                                From a similar ServerFault question, search/filter the Windows System Event Log for Event ID 6009.



                                On Windows 10: Event Viewer > Windows Logs > System and then the Filter Current Log... Action.






                                share|improve this answer


























                                  1












                                  1








                                  1







                                  From a similar ServerFault question, search/filter the Windows System Event Log for Event ID 6009.



                                  On Windows 10: Event Viewer > Windows Logs > System and then the Filter Current Log... Action.






                                  share|improve this answer













                                  From a similar ServerFault question, search/filter the Windows System Event Log for Event ID 6009.



                                  On Windows 10: Event Viewer > Windows Logs > System and then the Filter Current Log... Action.







                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Jul 17 '17 at 18:08









                                  palswimpalswim

                                  1,78382953




                                  1,78382953























                                      1














                                      I want to add, that all these commands really give you the timestamps when a 'restart' or 'reboot' is done. And not when a shutdown and start is done. After shutdown and start the 'lastbootuptime' will reflect the time the system is really 'restarted' and not the actual boot up time.
                                      So shutdown/start gives the same result as coming back from suspend/hybernnate for the LastBootUpTime timestamp.






                                      share|improve this answer




























                                        1














                                        I want to add, that all these commands really give you the timestamps when a 'restart' or 'reboot' is done. And not when a shutdown and start is done. After shutdown and start the 'lastbootuptime' will reflect the time the system is really 'restarted' and not the actual boot up time.
                                        So shutdown/start gives the same result as coming back from suspend/hybernnate for the LastBootUpTime timestamp.






                                        share|improve this answer


























                                          1












                                          1








                                          1







                                          I want to add, that all these commands really give you the timestamps when a 'restart' or 'reboot' is done. And not when a shutdown and start is done. After shutdown and start the 'lastbootuptime' will reflect the time the system is really 'restarted' and not the actual boot up time.
                                          So shutdown/start gives the same result as coming back from suspend/hybernnate for the LastBootUpTime timestamp.






                                          share|improve this answer













                                          I want to add, that all these commands really give you the timestamps when a 'restart' or 'reboot' is done. And not when a shutdown and start is done. After shutdown and start the 'lastbootuptime' will reflect the time the system is really 'restarted' and not the actual boot up time.
                                          So shutdown/start gives the same result as coming back from suspend/hybernnate for the LastBootUpTime timestamp.







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Aug 17 '18 at 11:38









                                          FloriszFlorisz

                                          111




                                          111























                                              1














                                              To get it in PowerShell:



                                              Function Get-LastBoot {
                                              if ($Host.Version.Major -lt 3) {
                                              Get-WmiObject win32_operatingsystem | Select-Object CSname, @{n = 'LastBootUpTime'; e = {$_.ConverttoDateTime($_.lastbootuptime)}}
                                              }
                                              else {
                                              Get-CimInstance -ClassName win32_operatingsystem | Select-Object CSname, LastBootUpTime
                                              }
                                              }


                                              Here's the result:



                                              CSname  LastBootUpTime
                                              ------ --------------
                                              LAPTOP1 2018-09-07 08:57:02





                                              share|improve this answer




























                                                1














                                                To get it in PowerShell:



                                                Function Get-LastBoot {
                                                if ($Host.Version.Major -lt 3) {
                                                Get-WmiObject win32_operatingsystem | Select-Object CSname, @{n = 'LastBootUpTime'; e = {$_.ConverttoDateTime($_.lastbootuptime)}}
                                                }
                                                else {
                                                Get-CimInstance -ClassName win32_operatingsystem | Select-Object CSname, LastBootUpTime
                                                }
                                                }


                                                Here's the result:



                                                CSname  LastBootUpTime
                                                ------ --------------
                                                LAPTOP1 2018-09-07 08:57:02





                                                share|improve this answer


























                                                  1












                                                  1








                                                  1







                                                  To get it in PowerShell:



                                                  Function Get-LastBoot {
                                                  if ($Host.Version.Major -lt 3) {
                                                  Get-WmiObject win32_operatingsystem | Select-Object CSname, @{n = 'LastBootUpTime'; e = {$_.ConverttoDateTime($_.lastbootuptime)}}
                                                  }
                                                  else {
                                                  Get-CimInstance -ClassName win32_operatingsystem | Select-Object CSname, LastBootUpTime
                                                  }
                                                  }


                                                  Here's the result:



                                                  CSname  LastBootUpTime
                                                  ------ --------------
                                                  LAPTOP1 2018-09-07 08:57:02





                                                  share|improve this answer













                                                  To get it in PowerShell:



                                                  Function Get-LastBoot {
                                                  if ($Host.Version.Major -lt 3) {
                                                  Get-WmiObject win32_operatingsystem | Select-Object CSname, @{n = 'LastBootUpTime'; e = {$_.ConverttoDateTime($_.lastbootuptime)}}
                                                  }
                                                  else {
                                                  Get-CimInstance -ClassName win32_operatingsystem | Select-Object CSname, LastBootUpTime
                                                  }
                                                  }


                                                  Here's the result:



                                                  CSname  LastBootUpTime
                                                  ------ --------------
                                                  LAPTOP1 2018-09-07 08:57:02






                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered Sep 12 '18 at 14:34









                                                  PollusBPollusB

                                                  1113




                                                  1113























                                                      1














                                                      Please note that as pointed out by Alex the /sleepstudy command wasn't added until Windows 8.1. /systempowerreport might work instead.



                                                      Note that some of these other answers never worked for me, like searching the event-log for example was always missing some entries. @Florisz's answer is also correct in that regard. Here is my solution:



                                                      In an administrator cmd shell, run the following command:



                                                      powercfg /sleepstudy /output sleepstudy.html


                                                      Then open the file sleepstudy.html in a browser. You will be greeted with amazingly organized statistics about shutdown/reboot/standby/hibernation from the last three days. (so, run periodically if you need)



                                                      An example of an output: (AFAIR, Showdown (Hybrid) means fast startup)



                                                      enter image description here



                                                      Source / Documentation | Also related






                                                      share|improve this answer





















                                                      • 1





                                                        This is what I was looking for on Windows 10! I don't reboot, I normally shutdown. LastBootTime only refers to reboots on Windows 10.

                                                        – tbc0
                                                        Oct 25 '18 at 14:34
















                                                      1














                                                      Please note that as pointed out by Alex the /sleepstudy command wasn't added until Windows 8.1. /systempowerreport might work instead.



                                                      Note that some of these other answers never worked for me, like searching the event-log for example was always missing some entries. @Florisz's answer is also correct in that regard. Here is my solution:



                                                      In an administrator cmd shell, run the following command:



                                                      powercfg /sleepstudy /output sleepstudy.html


                                                      Then open the file sleepstudy.html in a browser. You will be greeted with amazingly organized statistics about shutdown/reboot/standby/hibernation from the last three days. (so, run periodically if you need)



                                                      An example of an output: (AFAIR, Showdown (Hybrid) means fast startup)



                                                      enter image description here



                                                      Source / Documentation | Also related






                                                      share|improve this answer





















                                                      • 1





                                                        This is what I was looking for on Windows 10! I don't reboot, I normally shutdown. LastBootTime only refers to reboots on Windows 10.

                                                        – tbc0
                                                        Oct 25 '18 at 14:34














                                                      1












                                                      1








                                                      1







                                                      Please note that as pointed out by Alex the /sleepstudy command wasn't added until Windows 8.1. /systempowerreport might work instead.



                                                      Note that some of these other answers never worked for me, like searching the event-log for example was always missing some entries. @Florisz's answer is also correct in that regard. Here is my solution:



                                                      In an administrator cmd shell, run the following command:



                                                      powercfg /sleepstudy /output sleepstudy.html


                                                      Then open the file sleepstudy.html in a browser. You will be greeted with amazingly organized statistics about shutdown/reboot/standby/hibernation from the last three days. (so, run periodically if you need)



                                                      An example of an output: (AFAIR, Showdown (Hybrid) means fast startup)



                                                      enter image description here



                                                      Source / Documentation | Also related






                                                      share|improve this answer















                                                      Please note that as pointed out by Alex the /sleepstudy command wasn't added until Windows 8.1. /systempowerreport might work instead.



                                                      Note that some of these other answers never worked for me, like searching the event-log for example was always missing some entries. @Florisz's answer is also correct in that regard. Here is my solution:



                                                      In an administrator cmd shell, run the following command:



                                                      powercfg /sleepstudy /output sleepstudy.html


                                                      Then open the file sleepstudy.html in a browser. You will be greeted with amazingly organized statistics about shutdown/reboot/standby/hibernation from the last three days. (so, run periodically if you need)



                                                      An example of an output: (AFAIR, Showdown (Hybrid) means fast startup)



                                                      enter image description here



                                                      Source / Documentation | Also related







                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited Sep 27 '18 at 12:16

























                                                      answered Aug 21 '18 at 7:51









                                                      confetticonfetti

                                                      1,2643724




                                                      1,2643724








                                                      • 1





                                                        This is what I was looking for on Windows 10! I don't reboot, I normally shutdown. LastBootTime only refers to reboots on Windows 10.

                                                        – tbc0
                                                        Oct 25 '18 at 14:34














                                                      • 1





                                                        This is what I was looking for on Windows 10! I don't reboot, I normally shutdown. LastBootTime only refers to reboots on Windows 10.

                                                        – tbc0
                                                        Oct 25 '18 at 14:34








                                                      1




                                                      1





                                                      This is what I was looking for on Windows 10! I don't reboot, I normally shutdown. LastBootTime only refers to reboots on Windows 10.

                                                      – tbc0
                                                      Oct 25 '18 at 14:34





                                                      This is what I was looking for on Windows 10! I don't reboot, I normally shutdown. LastBootTime only refers to reboots on Windows 10.

                                                      – tbc0
                                                      Oct 25 '18 at 14:34











                                                      0














                                                      You can use PowerShell for this.



                                                      Shutdown





                                                      Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 200 }


                                                      This will give you a list of logged shutdown times.



                                                      Alternative command, better optimized for remote connections:



                                                      Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 200; }


                                                      Example output:



                                                      TimeCreated                     Id LevelDisplayName Message
                                                      ----------- -- ---------------- -------
                                                      2017-01-28 18:25:46 200 Critical Windows has shutdown
                                                      2016-11-01 19:55:21 200 Error Windows has shutdown
                                                      2016-10-29 00:18:38 200 Critical Windows has shutdown
                                                      2016-10-26 23:16:55 200 Warning Windows has shutdown
                                                      2016-10-26 15:37:40 200 Warning Windows has shutdown
                                                      2016-10-26 02:18:24 200 Warning Windows has shutdown
                                                      2016-10-26 02:10:34 200 Warning Windows has shutdown
                                                      2016-10-26 02:04:01 200 Warning Windows has shutdown
                                                      2016-10-25 14:23:11 200 Warning Windows has shutdown
                                                      2016-10-25 13:07:46 200 Error Windows has shutdown
                                                      2016-10-25 00:18:12 200 Error Windows has shutdown
                                                      2016-10-19 13:16:39 200 Critical Windows has shutdown


                                                      Startup





                                                      The following command will give you a list of logged startup times.



                                                      Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 100}


                                                      Alternative command, better optimized for remote connections:



                                                      Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 100; }


                                                      Example output:



                                                      TimeCreated                     Id LevelDisplayName Message
                                                      ----------- -- ---------------- -------
                                                      2017-10-07 21:35:38 100 Critical Windows has started up
                                                      2017-01-28 18:25:48 100 Critical Windows has started up
                                                      2016-12-11 17:45:07 100 Critical Windows has started up
                                                      2016-11-16 13:26:52 100 Critical Windows has started up
                                                      2016-11-01 19:55:21 100 Critical Windows has started up
                                                      2016-10-29 00:18:39 100 Critical Windows has started up
                                                      2016-10-26 23:16:55 100 Error Windows has started up
                                                      2016-10-26 14:51:07 100 Error Windows has started up
                                                      2016-10-26 02:24:01 100 Error Windows has started up
                                                      2016-10-26 02:18:24 100 Critical Windows has started up
                                                      2016-10-26 02:10:34 100 Error Windows has started up
                                                      2016-10-26 02:04:01 100 Critical Windows has started up
                                                      2016-10-25 14:23:12 100 Error Windows has started up
                                                      2016-10-25 13:07:47 100 Error Windows has started up
                                                      2016-10-25 12:56:23 100 Error Windows has started up
                                                      2016-10-19 13:16:39 100 Critical Windows has started up


                                                      I have tested this on PowerShell 5.1 and Windows 10.0.15063. But it should work on Windows 7 as well, as long as you have at least PowerShell 3.0. Note that you need to run it as admin.



                                                      You will find the full documentation for the command here:
                                                      docs.microsoft.com






                                                      share|improve this answer


























                                                      • Didn't work for me on Windows 10. Not even as admin. See snag.gy/HcEn8j.jpg

                                                        – tbc0
                                                        Jul 13 '18 at 17:27


















                                                      0














                                                      You can use PowerShell for this.



                                                      Shutdown





                                                      Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 200 }


                                                      This will give you a list of logged shutdown times.



                                                      Alternative command, better optimized for remote connections:



                                                      Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 200; }


                                                      Example output:



                                                      TimeCreated                     Id LevelDisplayName Message
                                                      ----------- -- ---------------- -------
                                                      2017-01-28 18:25:46 200 Critical Windows has shutdown
                                                      2016-11-01 19:55:21 200 Error Windows has shutdown
                                                      2016-10-29 00:18:38 200 Critical Windows has shutdown
                                                      2016-10-26 23:16:55 200 Warning Windows has shutdown
                                                      2016-10-26 15:37:40 200 Warning Windows has shutdown
                                                      2016-10-26 02:18:24 200 Warning Windows has shutdown
                                                      2016-10-26 02:10:34 200 Warning Windows has shutdown
                                                      2016-10-26 02:04:01 200 Warning Windows has shutdown
                                                      2016-10-25 14:23:11 200 Warning Windows has shutdown
                                                      2016-10-25 13:07:46 200 Error Windows has shutdown
                                                      2016-10-25 00:18:12 200 Error Windows has shutdown
                                                      2016-10-19 13:16:39 200 Critical Windows has shutdown


                                                      Startup





                                                      The following command will give you a list of logged startup times.



                                                      Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 100}


                                                      Alternative command, better optimized for remote connections:



                                                      Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 100; }


                                                      Example output:



                                                      TimeCreated                     Id LevelDisplayName Message
                                                      ----------- -- ---------------- -------
                                                      2017-10-07 21:35:38 100 Critical Windows has started up
                                                      2017-01-28 18:25:48 100 Critical Windows has started up
                                                      2016-12-11 17:45:07 100 Critical Windows has started up
                                                      2016-11-16 13:26:52 100 Critical Windows has started up
                                                      2016-11-01 19:55:21 100 Critical Windows has started up
                                                      2016-10-29 00:18:39 100 Critical Windows has started up
                                                      2016-10-26 23:16:55 100 Error Windows has started up
                                                      2016-10-26 14:51:07 100 Error Windows has started up
                                                      2016-10-26 02:24:01 100 Error Windows has started up
                                                      2016-10-26 02:18:24 100 Critical Windows has started up
                                                      2016-10-26 02:10:34 100 Error Windows has started up
                                                      2016-10-26 02:04:01 100 Critical Windows has started up
                                                      2016-10-25 14:23:12 100 Error Windows has started up
                                                      2016-10-25 13:07:47 100 Error Windows has started up
                                                      2016-10-25 12:56:23 100 Error Windows has started up
                                                      2016-10-19 13:16:39 100 Critical Windows has started up


                                                      I have tested this on PowerShell 5.1 and Windows 10.0.15063. But it should work on Windows 7 as well, as long as you have at least PowerShell 3.0. Note that you need to run it as admin.



                                                      You will find the full documentation for the command here:
                                                      docs.microsoft.com






                                                      share|improve this answer


























                                                      • Didn't work for me on Windows 10. Not even as admin. See snag.gy/HcEn8j.jpg

                                                        – tbc0
                                                        Jul 13 '18 at 17:27
















                                                      0












                                                      0








                                                      0







                                                      You can use PowerShell for this.



                                                      Shutdown





                                                      Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 200 }


                                                      This will give you a list of logged shutdown times.



                                                      Alternative command, better optimized for remote connections:



                                                      Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 200; }


                                                      Example output:



                                                      TimeCreated                     Id LevelDisplayName Message
                                                      ----------- -- ---------------- -------
                                                      2017-01-28 18:25:46 200 Critical Windows has shutdown
                                                      2016-11-01 19:55:21 200 Error Windows has shutdown
                                                      2016-10-29 00:18:38 200 Critical Windows has shutdown
                                                      2016-10-26 23:16:55 200 Warning Windows has shutdown
                                                      2016-10-26 15:37:40 200 Warning Windows has shutdown
                                                      2016-10-26 02:18:24 200 Warning Windows has shutdown
                                                      2016-10-26 02:10:34 200 Warning Windows has shutdown
                                                      2016-10-26 02:04:01 200 Warning Windows has shutdown
                                                      2016-10-25 14:23:11 200 Warning Windows has shutdown
                                                      2016-10-25 13:07:46 200 Error Windows has shutdown
                                                      2016-10-25 00:18:12 200 Error Windows has shutdown
                                                      2016-10-19 13:16:39 200 Critical Windows has shutdown


                                                      Startup





                                                      The following command will give you a list of logged startup times.



                                                      Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 100}


                                                      Alternative command, better optimized for remote connections:



                                                      Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 100; }


                                                      Example output:



                                                      TimeCreated                     Id LevelDisplayName Message
                                                      ----------- -- ---------------- -------
                                                      2017-10-07 21:35:38 100 Critical Windows has started up
                                                      2017-01-28 18:25:48 100 Critical Windows has started up
                                                      2016-12-11 17:45:07 100 Critical Windows has started up
                                                      2016-11-16 13:26:52 100 Critical Windows has started up
                                                      2016-11-01 19:55:21 100 Critical Windows has started up
                                                      2016-10-29 00:18:39 100 Critical Windows has started up
                                                      2016-10-26 23:16:55 100 Error Windows has started up
                                                      2016-10-26 14:51:07 100 Error Windows has started up
                                                      2016-10-26 02:24:01 100 Error Windows has started up
                                                      2016-10-26 02:18:24 100 Critical Windows has started up
                                                      2016-10-26 02:10:34 100 Error Windows has started up
                                                      2016-10-26 02:04:01 100 Critical Windows has started up
                                                      2016-10-25 14:23:12 100 Error Windows has started up
                                                      2016-10-25 13:07:47 100 Error Windows has started up
                                                      2016-10-25 12:56:23 100 Error Windows has started up
                                                      2016-10-19 13:16:39 100 Critical Windows has started up


                                                      I have tested this on PowerShell 5.1 and Windows 10.0.15063. But it should work on Windows 7 as well, as long as you have at least PowerShell 3.0. Note that you need to run it as admin.



                                                      You will find the full documentation for the command here:
                                                      docs.microsoft.com






                                                      share|improve this answer















                                                      You can use PowerShell for this.



                                                      Shutdown





                                                      Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 200 }


                                                      This will give you a list of logged shutdown times.



                                                      Alternative command, better optimized for remote connections:



                                                      Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 200; }


                                                      Example output:



                                                      TimeCreated                     Id LevelDisplayName Message
                                                      ----------- -- ---------------- -------
                                                      2017-01-28 18:25:46 200 Critical Windows has shutdown
                                                      2016-11-01 19:55:21 200 Error Windows has shutdown
                                                      2016-10-29 00:18:38 200 Critical Windows has shutdown
                                                      2016-10-26 23:16:55 200 Warning Windows has shutdown
                                                      2016-10-26 15:37:40 200 Warning Windows has shutdown
                                                      2016-10-26 02:18:24 200 Warning Windows has shutdown
                                                      2016-10-26 02:10:34 200 Warning Windows has shutdown
                                                      2016-10-26 02:04:01 200 Warning Windows has shutdown
                                                      2016-10-25 14:23:11 200 Warning Windows has shutdown
                                                      2016-10-25 13:07:46 200 Error Windows has shutdown
                                                      2016-10-25 00:18:12 200 Error Windows has shutdown
                                                      2016-10-19 13:16:39 200 Critical Windows has shutdown


                                                      Startup





                                                      The following command will give you a list of logged startup times.



                                                      Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 100}


                                                      Alternative command, better optimized for remote connections:



                                                      Get-WinEvent -FilterHashtable @{LogName = "Microsoft-Windows-Diagnostics-Performance/Operational"; Id = 100; }


                                                      Example output:



                                                      TimeCreated                     Id LevelDisplayName Message
                                                      ----------- -- ---------------- -------
                                                      2017-10-07 21:35:38 100 Critical Windows has started up
                                                      2017-01-28 18:25:48 100 Critical Windows has started up
                                                      2016-12-11 17:45:07 100 Critical Windows has started up
                                                      2016-11-16 13:26:52 100 Critical Windows has started up
                                                      2016-11-01 19:55:21 100 Critical Windows has started up
                                                      2016-10-29 00:18:39 100 Critical Windows has started up
                                                      2016-10-26 23:16:55 100 Error Windows has started up
                                                      2016-10-26 14:51:07 100 Error Windows has started up
                                                      2016-10-26 02:24:01 100 Error Windows has started up
                                                      2016-10-26 02:18:24 100 Critical Windows has started up
                                                      2016-10-26 02:10:34 100 Error Windows has started up
                                                      2016-10-26 02:04:01 100 Critical Windows has started up
                                                      2016-10-25 14:23:12 100 Error Windows has started up
                                                      2016-10-25 13:07:47 100 Error Windows has started up
                                                      2016-10-25 12:56:23 100 Error Windows has started up
                                                      2016-10-19 13:16:39 100 Critical Windows has started up


                                                      I have tested this on PowerShell 5.1 and Windows 10.0.15063. But it should work on Windows 7 as well, as long as you have at least PowerShell 3.0. Note that you need to run it as admin.



                                                      You will find the full documentation for the command here:
                                                      docs.microsoft.com







                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited Oct 7 '17 at 20:34

























                                                      answered Oct 7 '17 at 19:32









                                                      SamirSamir

                                                      11.4k57144205




                                                      11.4k57144205













                                                      • Didn't work for me on Windows 10. Not even as admin. See snag.gy/HcEn8j.jpg

                                                        – tbc0
                                                        Jul 13 '18 at 17:27





















                                                      • Didn't work for me on Windows 10. Not even as admin. See snag.gy/HcEn8j.jpg

                                                        – tbc0
                                                        Jul 13 '18 at 17:27



















                                                      Didn't work for me on Windows 10. Not even as admin. See snag.gy/HcEn8j.jpg

                                                      – tbc0
                                                      Jul 13 '18 at 17:27







                                                      Didn't work for me on Windows 10. Not even as admin. See snag.gy/HcEn8j.jpg

                                                      – tbc0
                                                      Jul 13 '18 at 17:27













                                                      0














                                                      A couple of answers mentions net statistics workstation and I've noted that both :



                                                      net statistics server


                                                      and



                                                      net statistics workstation


                                                      should provide data regarding last boot on the Statistics since ... line.



                                                      However, some OS versions (like Svr2008/6.0) will return 1/1/1980 12:00 for the date when using server. So I'll default to workstation.



                                                      Also you can abbreviate some of the command like net stats workstation and get the same results. Finally, if you jump around from system to system, the default CMD box isn't large enough to show all results from the command. So I'll pipe the output to more to avoid scrolling up to see the boot time. Therefore, my default command is:



                                                      net stats workstation | more


                                                      command






                                                      share|improve this answer






























                                                        0














                                                        A couple of answers mentions net statistics workstation and I've noted that both :



                                                        net statistics server


                                                        and



                                                        net statistics workstation


                                                        should provide data regarding last boot on the Statistics since ... line.



                                                        However, some OS versions (like Svr2008/6.0) will return 1/1/1980 12:00 for the date when using server. So I'll default to workstation.



                                                        Also you can abbreviate some of the command like net stats workstation and get the same results. Finally, if you jump around from system to system, the default CMD box isn't large enough to show all results from the command. So I'll pipe the output to more to avoid scrolling up to see the boot time. Therefore, my default command is:



                                                        net stats workstation | more


                                                        command






                                                        share|improve this answer




























                                                          0












                                                          0








                                                          0







                                                          A couple of answers mentions net statistics workstation and I've noted that both :



                                                          net statistics server


                                                          and



                                                          net statistics workstation


                                                          should provide data regarding last boot on the Statistics since ... line.



                                                          However, some OS versions (like Svr2008/6.0) will return 1/1/1980 12:00 for the date when using server. So I'll default to workstation.



                                                          Also you can abbreviate some of the command like net stats workstation and get the same results. Finally, if you jump around from system to system, the default CMD box isn't large enough to show all results from the command. So I'll pipe the output to more to avoid scrolling up to see the boot time. Therefore, my default command is:



                                                          net stats workstation | more


                                                          command






                                                          share|improve this answer















                                                          A couple of answers mentions net statistics workstation and I've noted that both :



                                                          net statistics server


                                                          and



                                                          net statistics workstation


                                                          should provide data regarding last boot on the Statistics since ... line.



                                                          However, some OS versions (like Svr2008/6.0) will return 1/1/1980 12:00 for the date when using server. So I'll default to workstation.



                                                          Also you can abbreviate some of the command like net stats workstation and get the same results. Finally, if you jump around from system to system, the default CMD box isn't large enough to show all results from the command. So I'll pipe the output to more to avoid scrolling up to see the boot time. Therefore, my default command is:



                                                          net stats workstation | more


                                                          command







                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited Jun 4 '18 at 10:38









                                                          C0deDaedalus

                                                          1,1681216




                                                          1,1681216










                                                          answered May 23 '18 at 16:10









                                                          ictmictm

                                                          1




                                                          1























                                                              0














                                                              Same as Max answer ...



                                                              for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                                                              set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                                                              echo DTS : %DTS%
                                                              echo BOOTTIME :%BOOTTIME%


                                                              ...but in oneliner:



                                                              for /f %a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%a && echo %DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%


                                                              This wmi implementation may appear a little messy but it's very fast compared to other powershell or systeminfo implementations and you can easily change the format since it's explicit in the code.



                                                              Thank you Max.






                                                              share|improve this answer




























                                                                0














                                                                Same as Max answer ...



                                                                for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                                                                set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                                                                echo DTS : %DTS%
                                                                echo BOOTTIME :%BOOTTIME%


                                                                ...but in oneliner:



                                                                for /f %a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%a && echo %DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%


                                                                This wmi implementation may appear a little messy but it's very fast compared to other powershell or systeminfo implementations and you can easily change the format since it's explicit in the code.



                                                                Thank you Max.






                                                                share|improve this answer


























                                                                  0












                                                                  0








                                                                  0







                                                                  Same as Max answer ...



                                                                  for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                                                                  set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                                                                  echo DTS : %DTS%
                                                                  echo BOOTTIME :%BOOTTIME%


                                                                  ...but in oneliner:



                                                                  for /f %a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%a && echo %DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%


                                                                  This wmi implementation may appear a little messy but it's very fast compared to other powershell or systeminfo implementations and you can easily change the format since it's explicit in the code.



                                                                  Thank you Max.






                                                                  share|improve this answer













                                                                  Same as Max answer ...



                                                                  for /f %%a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%%a
                                                                  set BOOTTIME=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%
                                                                  echo DTS : %DTS%
                                                                  echo BOOTTIME :%BOOTTIME%


                                                                  ...but in oneliner:



                                                                  for /f %a in ('WMIC OS GET lastbootuptime ^| find "."') DO set DTS=%a && echo %DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% %DTS:~8,2%:%DTS:~10,2%


                                                                  This wmi implementation may appear a little messy but it's very fast compared to other powershell or systeminfo implementations and you can easily change the format since it's explicit in the code.



                                                                  Thank you Max.







                                                                  share|improve this answer












                                                                  share|improve this answer



                                                                  share|improve this answer










                                                                  answered Feb 21 at 16:36









                                                                  LoïcLoïc

                                                                  1




                                                                  1






























                                                                      draft saved

                                                                      draft discarded




















































                                                                      Thanks for contributing an answer to Super User!


                                                                      • Please be sure to answer the question. Provide details and share your research!

                                                                      But avoid



                                                                      • Asking for help, clarification, or responding to other answers.

                                                                      • Making statements based on opinion; back them up with references or personal experience.


                                                                      To learn more, see our tips on writing great answers.




                                                                      draft saved


                                                                      draft discarded














                                                                      StackExchange.ready(
                                                                      function () {
                                                                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f523726%2fhow-can-i-find-out-when-windows-was-last-restarted%23new-answer', 'question_page');
                                                                      }
                                                                      );

                                                                      Post as a guest















                                                                      Required, but never shown





















































                                                                      Required, but never shown














                                                                      Required, but never shown












                                                                      Required, but never shown







                                                                      Required, but never shown

































                                                                      Required, but never shown














                                                                      Required, but never shown












                                                                      Required, but never shown







                                                                      Required, but never shown







                                                                      Popular posts from this blog

                                                                      Probability when a professor distributes a quiz and homework assignment to a class of n students.

                                                                      Aardman Animations

                                                                      Are they similar matrix