The main body checks for 1 argument passed when the script is ran; if the number of arguments is not equal to 1, then the script exits. It then calls for the GetUptime procedure:
The GetUptime procedure queries WMI for the Win32_PerfRawData_PerfOS_System class, in particular the Timestamp_Object, Frequency_Object, and the SystemUpTime properties. To calculate for the system uptime in seconds (in my example, I used the iUptimeInSec variable), the following formula was used:
iUptimeInSec = (intPerfTimeStamp - intCounter)/intPerfTimeFreq
This value is then passed to the ConvertTime(seconds) function.
The iUptimeInSec variable was converted to an easier-t0-read format, eg. days, hours, minutes and seconds.
No comments:
Post a Comment