≡ Menu

Say hello to uptime2.exe: Alternative for uptime.exe

[ Now-a-days many people are capable of writing and using Powershell codes. Given this fact, the uptime2.exe is removed. There is a better PowerShell alternative for this at https://techibee.com/powershell/get-computer-uptime-using-powershell/659]

Ever since I started using Windows 7/Windows 2008 R2 Operating System this problem is there. Uptime.exe utility crashes with error message “Calculates system uptime and availability has stopped working” when I use with “/S” option. The /S option of uptime.exe gives the historical information about computer startup and shutdown times. This information is very useful to understand how many times a computer rebooted.

Since this built-in tool is not working, I explored the ways to get the last X reboots information from a PC using alternate methods. In early stages, I assumed this historical reboot information is stored in some WMI or file system so that I can easily query. After long wait, I came to know that it is actually based on event logs. All we need to do is parse event logs and get the historical startup and shutdown times of the computer.

After knowing the source of information, my interest towards building my own solution to get the last X reboot times information has increased. I did it in powershell and used it whenever I needed. However, I felt having a powershell function may be easy way for folks like me who want to get their hand dirty with powershell. Other system administrators really won’t like it as they need to open powershell, look for command and type it there to get the required output. For various reasons, powershell console a slow staring application. Also it is difficult to remember the function name(or equivalent code) to get the reboots information. Given these reasons, I wanted to build a quick alternative, and that is when Uptime2.exe born.

So I developed a C# console application which mimics the functionality of uptime.exe tool in windows and returns the output we need. “C# application? Hey Poweshell guy, what happened to you?” – Nothing really but somehow I liked the language and started exploring more. Still PS is my best choice for quick and dirty tasks. In fact PS made me my dive into c# very easy and quick. Keeping my happening aside let me talk more about the tool I developed.

The uptime2.exe is a C# console application. It takes two parameters mainly, /Computername and /S. The ComputerName parameter is for querying the information from remote computer and “/S” option works the same way as in uptime.exe – i.e generates historical reboot information. When none of these parameters are specified, the tool just returns the uptime of local computer.

I have too many plans for enhancing this tool. But don’t have enough time in hand at this moment. This is the best shape I can give my thoughts in 5 hours(yes, it took me that much). However, when I ever I find time, I will try to improve it to return more information like Timezone of remote computer(I think no tool does this right now), display last boot time, etc (if you think a feature is worth adding here, please mention in comments section).

I briefly tested this tool in my lab and is giving the desired results. I took care of error handling to the possible extent I can. If you notice any errors, please report to me.

Download:

You can download the tool from here (not available for download anymore) and use it for your requirements. It is FREE. I will share the code as well once my GIT repository is ready for usage.

[Updates]

08/16/2012 : Initial release

08/18/2012: Fixed a bug with time conversion.(Thanks to Srinivas for reporting it)

Below are the a few use cases:

  • c:\>Uptime2.exe — gets the uptime of local computer
  • c:\>Uptime2.exe /s —  gives the historical reboot information of local computer.
  • c:\>Uptime2.exe /computername:mypc1 — give the uptime information of remote computer
  • c:\>Uptime.exe  /computername:mypc1 /s  — gives the historical reboot information of remote computer.

 Disclaimer:

Well, I felt I should add a disclaimer for this utility. Please test the tool in test environment before trying in production. I AM NO WAY RESPONSIBLE FOR ANY KIND OF DAMAGE MADE BY THIS TOOL. USE AT YOUR OWN RISK.

Happy learning and let me know your feedback.

 

 

Comments on this entry are closed.

  • Srini August 17, 2012, 6:43 am

    Very helpful and handy tool…

  • Aakash Shah October 30, 2012, 2:28 am

    Hello! I wanted to know if you had a chance to upload the code for uptime2.exe? Thanks!

  • RaStr November 8, 2012, 6:48 pm

    Very nice, but incomplete as there is no final overview with totals, etc.
    Finally I have debugged successfully the original MS uptime.exe, discovered where is the problem and fixed it! So if enyone wants that fixed version, feel free to PM me so I can mail it to you or publish it somewhere.

    • nmuzic November 15, 2012, 11:18 pm

      Hi, I need that fixed version. Please send me to nmuzic@gmail.com

    • Techie November 29, 2012, 4:27 am

      Hello RaStr,

      Could you please send me your fixed version of MS’s uptime.exe to techgooroo@gmail.com.

      Thanks!

    • klausi January 3, 2013, 4:18 pm

      Could you please send me your fixed version of MS’s uptime.exe to klauskx@web.de

    • Devastator0 January 15, 2013, 12:22 pm

      Hi, could you please send the that fixed version to me at Devastator0@hotmail.com

      Thanks! 🙂

    • M. Gorman April 26, 2013, 7:52 pm

      Could you please send?

      Thanks!!!!

    • Adam May 22, 2013, 8:58 pm

      Could you send me the fixed version? Please send to gordierav@gmail.com

    • JLaw May 23, 2013, 9:55 pm

      Hi
      Would really appreciate your updated version to!
      lizardking@outlook.com

      Cheers

    • cibber July 25, 2013, 1:36 am

      Hi RaStr,

      mind telling us how you fixed the original MS version? I’m currently using the original uptime.exe in a Win03 environment and as some very strict rules apply to this env I’m not allowed to use “3rd-party” tools. Our auditors would certainly consider your patched version as being 3rd-party 🙁

      We’re going to switch to Win12 soon and rather than rewriting the scripts using uptime.exe to utilize some other mechanism I’d try patching the original version myself. THAT would not be considered 3rd-party…

      Hope you still monitor this thread. Looking forward to hearing from you!

      Regards,
      cibber

      • ASB April 15, 2016, 5:39 pm

        Did you (or anyone else) ever get an answer from RaStr?

        • Wintel Rocks April 17, 2016, 8:34 am

          Hi @ASB, @All, if you still see a need for having a uptime2.exe(which provides same output as uptime.exe), I can upload it to this post. But I would like to understand if you are still seeing this problem. I haven’t noticed it for long time on either windows 2008 or 2012.

        • Wintel Rocks April 17, 2016, 8:38 am

          You may also want to try this powershell code: http://techibee.com/powershell/get-computer-uptime-using-powershell/659

          By using powershell, you are avoiding the need for using external executable.

          • ASB June 16, 2016, 12:03 am

            What folks are looking for in UPTIME.EXE is the /S and /P functionality, which this replacement tool does not have.

            I’d love to hear if anyone else here received the updated version, because I have not been able to reach RaStr directly.

            Regards,

            -ASB

          • Wintel Rocks September 24, 2016, 10:32 am

            ASB, what does /p do? Now a days most of the tasks can be easily accomplished with PowerShell. I should be able to suggest a alternative using PowerShell if you share the requirement.

          • ASB April 12, 2018, 6:57 am

            An external executable is not necessarily a problem for many environments.

            >uptime \\mysystem /p:30
            Uptime Report for: \\mysystem

            Current OS: Windows 10 Pro Multiprocessor Free.
            Time Zone: @tzres.dll,-111

            System Events as of 4/11/2018 9:21:52 PM:

            Date: Time: Event: Comment:
            ———- ———– ——————- ———————————–

            Current System Uptime: 32 day(s), 6 hour(s), 56 minute(s), 15 second(s)

            ——————————————————————————–

            Since 3/12/2018: (Last 30 Days)

            System Availability: 100.0000%
            Total Uptime: 30d 21h:21m:52s
            Total Downtime: 0d 0h:0m:0s
            Total Reboots: 0
            Total Bluescreens: 0

            >uptime \\mysystem /p:60
            Uptime Report for: \\mysystem

            Current OS: Windows 10 Pro Multiprocessor Free.
            Time Zone: @tzres.dll,-111

            System Events as of 4/11/2018 9:22:39 PM:

            Date: Time: Event: Comment:
            ———- ———– ——————- ———————————–
            2/19/2018 11:08:22 AM Shutdown Prior uptime:27d 1h:28m:7s
            2/24/2018 1:16:12 PM Boot Prior downtime:5d 2h:7m:50s
            2/24/2018 1:16:13 PM Shutdown Prior uptime:0d 0h:0m:1s
            2/24/2018 1:17:00 PM Boot Prior downtime:0d 0h:0m:47s
            2/26/2018 6:54:09 PM Shutdown Prior uptime:2d 5h:37m:9s
            2/26/2018 6:54:54 PM Boot Prior downtime:0d 0h:0m:45s
            3/10/2018 1:22:49 PM Shutdown Prior uptime:11d 18h:27m:55s
            3/10/2018 1:26:33 PM Boot Prior downtime:0d 0h:3m:44s

            Current System Uptime: 32 day(s), 6 hour(s), 57 minute(s), 4 second(s)

            ——————————————————————————–

            Since 2/9/2018: (Last 60 Days)

            System Availability: 91.6368%
            Total Uptime: 55d 19h:9m:33s
            Total Downtime: 5d 2h:13m:6s
            Total Reboots: 4
            Mean Time Between Reboots: 15.22 days
            Total Bluescreens: 0

            This is the extended output that many were already used to.

            -ASB

    • xtech November 8, 2013, 8:43 pm

      Hello RaStr,

      Could you please send me your fixed version of MS’s uptime.exe to xtech123@outlook.com.

      Thanks!

    • S Gross April 21, 2014, 9:55 pm

      RaStr,

      Hope you are still monitoring this thread. Could you send me the fixed Microsoft uptime.exe file?

      Since my E-Mail filters exe, is there a place I can download it?

      Thanks in advance!

    • smarty May 26, 2014, 3:08 pm

      Hi, I need that fixed version. Please send me to ytrams@hotmail.com

    • Pradeep September 1, 2014, 12:25 pm

      Hi, can you please send me the fixed version to spradeep2801@gmail.com

    • Jan Samborski December 11, 2014, 12:51 am

      please send me your updated uptime.exe

      Thanks,
      Jan

    • alan April 8, 2015, 7:59 am

      I would like to have a copy of your uptime2.exe. Thank a lot.

    • BinaryD May 1, 2015, 12:24 am

      Hey RaStr,

      Supper awesome to hear someone has a fix. You are a life saver. Please send me the fix you found. Greatly appreciate it.

  • Shashi February 27, 2013, 10:04 pm

    Hi,

    Can we have the same switches like uptime.exe (x86) for Windows 2008/Windows7?
    If you have the updated fix version please send me on shashisurve@hotmail.com

  • Henry March 19, 2013, 8:18 pm

    Could you please send me your fixed version of MS’s uptime.exe to heinz.dubach@feusi.ch
    Thanks!

  • Trevor Lourens March 20, 2013, 1:08 pm

    Could you please email me the fixed version Trevor.lourens@t-systems.co.za

  • Horst March 28, 2013, 4:29 pm

    Could you please email me the fixed version to horstmann@bossmail.de
    Thanks

  • John April 2, 2013, 3:45 pm

    Hi,

    Thanks for the great tools. It will be good for me if you can enhance it to calculate the server uptime in certain period of time. I’m using uptime.exe to calculate monthly server uptime report and submit to management.

    Below are my batch command used previously.

    REM start from mm/dd/yyyy
    uptime server1 /s /d:%1 > server1_2013-03.txt
    uptime server2 /s /d:%1 > server2_2013-03.txt
    uptime server3 /s /d:%1 > server3_2013-03.txt

  • Redearl May 27, 2013, 8:18 am

    Just down loaded your uptime2 tool and attempted to run it on an XP sp3, with all current patches.
    I get the following error.

    C:\>uptime2
    This utility is developed by Sitaram Pamarthi`(http://techibee.com`)
    Use /nologo parameter to suppress this banner message

    Failed to get uptime.

  • Kanti June 22, 2013, 1:07 am

    Sitaram, this is a nice tool to have. Do you have plans to share the source code?

  • Nahuel August 16, 2013, 12:06 am

    This app generate

    System Availability: 100.0000%
    Total Uptime: 2d 4h:59m:39s
    Total Downtime: 0d 0h:0m:0s
    Total Reboots: 0
    Total Bluescreens: 0

    uptime.exe normal yes, when used /s don´t have anything.

  • RAHUL JAIN November 11, 2013, 6:39 pm

    Hi,

    If you can provide me the updated version of uptime.exe file, will be a great help.

    Thanks in advance for the same.

  • Bibine February 13, 2014, 9:30 pm

    Hi,

    Can you provide me the updated version of uptime.exe please ?

    Thank you very much !

  • Raj March 5, 2014, 9:07 pm

    Hi Sitaram,

    Uptime2 dose not show the system availability in %. Can you check this and fix this

    • Sitaram Pamarthi March 6, 2014, 6:41 pm

      System availability in %? This tool is to give uptime only. The availability is factory of many other things and this tool will not cover that.

  • Shiva December 19, 2014, 5:09 pm

    Very Nice Tool..Keep up the Good Work

  • Miggity Mike May 28, 2015, 9:07 pm

    This tool does not work on remote computers. It persists on giving me info on the machine I run it on.

    uptime2 /computername /s

  • Jim June 3, 2015, 12:08 am

    /s command does not work at all on the uptime2.exe utility. Did anyone on this string ever receive a copy of the (apparently) fixed original version of uptime put out by microsoft or was that just someone claiming they had fixed it?

  • David April 4, 2016, 2:00 pm

    Could you please send me your fixed version of MS’s uptime.exe to

  • MrJ October 19, 2016, 3:33 am

    Uptime2v1.1.zip was not liked by Windows Defender in Win 10. FYI

    Detected: Trojan:Win32/Spursint.A!cl
    Alert Level: Severe

    Category: Trojan
    Description: This program is dangerous and executes commands from an attacker.
    Recommended action: Remove this software immediately.

    Items:
    containerfile:C:\ProgramData\Microsoft\Windows Defender\Scans\FilesStash\5B661B4E-1C06-3754-9033-4C1AEB5C423E_1d22a54338892da
    file:C:\ProgramData\Microsoft\Windows Defender\Scans\FilesStash\5B661B4E-1C06-3754-9033-4C1AEB5C423E_1d22a54338892da->(MPLC)
    file:D:\Users\Joshua\Downloads\Uptime2v1.1.zip
    webfile:C:\ProgramData\Microsoft\Windows Defender\Scans\FilesStash\5B661B4E-1C06-3754-9033-4C1AEB5C423E_1d22a54338892da|http://techibee.com/wp-content/uploads/2012/08/Uptime2v1.1.zip|chrome.exe
    webfile:D:\Users\Joshua\Downloads\Uptime2v1.1.zip|http://techibee.com/wp-content/uploads/2012/08/Uptime2v1.1.zip|chrome.exe

    Get more information about this item online.
    https://www.microsoft.com/security/portal/threat/encyclopedia/entry.aspx?name=Trojan%3aWin32%2fSpursint.A!cl&threatid=2147705703&enterprise=0

    • Wintel Rocks December 15, 2016, 8:34 pm

      Thanks for reporting. We have removed this exe from downloads section.

  • Ginsmon Joseph July 24, 2017, 5:36 pm

    Could you please share the link to download the uptime.exe which could give me the historical data which we were able to get in Windows 2003 using the version1

    • Wintel Rocks August 13, 2017, 9:56 am

      Hi Joseph,

      I have disabled the download because some people reported that their AV is not treating this application well. You can easily achieve this using PowerShell.