No announcement yet.

Looking for PC-Uptime (not hs.systemuptime)

  • Filter
  • Time
  • Show
Clear All
new posts

  • electron
    whew, several ways of doing this

    on XP you could capture this output:
    <pre class="ip-ubbcode-code-pre">systeminfo | findstr "Up.Time"</pre>

    on Win2k, you could install uptime.exe from the support tools on the win2k CD

    You could also download uptime.exe from sysinternals which will run on any OS of your choice (

    and I found this piece of script in my vbs library, ran fine on XP , didn't test it on any other machines.
    <pre class="ip-ubbcode-code-pre">
    Dim objFileSystem
    Dim objOutputFile
    Dim objService
    Dim objOSSet
    Dim objOS
    Dim strWBEMClass

    strWBEMClass = "Win32_OperatingSystem"

    Set objLocator = CreateObject("WbemScripting.SWbemLocator")
    Set objService = objLocator.ConnectServer (strServer, strNameSpace,strUserName, strPassword)

    ObjService.Security_.impersonationlevel = 3

    Set objOSSet = objService.InstancesOf(strWBEMClass)

    For Each objOS in objOSSet

    MsgBox("Last Bootup = " & formatTime(objOS.LastBootUpTime))


    Private Function formatTime(strDate)
    Dim str
    str = Mid(strDate,1,4) & "-" _
    & Mid(strDate,5,2) & "-" _
    & Mid(strDate,7,2) & ", " _
    & Mid(strDate,9,2) & ":" _
    & Mid(strDate,11,2) & ":" _
    & Mid(strDate,13,2)
    formatTime = str
    End Function


    Let me know if any of this worked. Good luck

    Leave a comment:

  • Hunter Green
    I have a command running during my computer's startup (I do it from the Windows Startup group, but you could use autoexec.bat if you would rather see the minute the PC starts rather than when Windows is running) which modifies a file called C:\Lastboot.txt. The command is simple: date &gt;c:\lastboot.txt

    Then I simply look at the file's last modification date using the functions in my File Properties include. That's the date of the last system boot.

    I can use my standard Since string generation include script to convert that datestamp into a string like "Yesterday at 7:11am" or "Saturday at 9:53pm" or "2002-10-11 at 12:15pm".

    Nucleus Home Automation | System Specs

    Leave a comment:

  • bennyb
    started a topic Looking for PC-Uptime (not hs.systemuptime)

    Looking for PC-Uptime (not hs.systemuptime)

    I would like to display system uptime (when PC was started) not the time HS was up.
    How can I get this using vbs ??