Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
strComputer = "."
'Note: Use "." above for the local computer or replace the "." with either the computername (local subnet)
'or an IP address (different subnet) of a remote PC
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer _
& "\root\cimv2")
If Err.Number = 0 Then
On Error Goto 0
strQuery = "select * from Win32_PerfRawData_PerfOS_System"
Set colObjects = objWMIService.ExecQuery(strQuery)
For Each objWmiObject In colObjects
intPerfTimeStamp = objWmiObject.Timestamp_Object
intPerfTimeFreq = objWmiObject.Frequency_Object
intCounter = objWmiObject.SystemUpTime
Next
' Calculation in seconds:
' Calculations for Raw Counter Data:PERF_ELAPSED_TIME
' [URL unfurl="true"]http://msdn.microsoft.com/library/en-us/perfmon/base/perf_elapsed_tim...[/URL]
iUptimeInSec = (intPerfTimeStamp - intCounter)/intPerfTimeFreq
WScript.Echo "Uptime in seconds: " & iUptimeInSec \ 1
' Convert the seconds
sUptime = ConvertTime(iUptimeInSec)
WScript.Echo "Uptime: " & sUptime
Else
Wscript.Echo "Could not connect to computer with WMI: " _
& strComputer
End If
Function ConvertTime(seconds)
ConvSec = seconds Mod 60
ConvMin = (seconds Mod 3600) \ 60
ConvHour = (seconds Mod (3600 * 24)) \ 3600
ConvDays = seconds \ (3600 * 24)
ConvertTime = ConvDays & " days " & ConvHour & " hours " _
& ConvMin & " minutes " & ConvSec & " seconds "
End Function