Friday, February 27, 2009
Moderating the "The Official Scripting Guys" Forum in Technet
Labels:
Operating Systems,
Scripting,
Technology
Thursday, February 12, 2009
Checking for the Uptime of a Remote Computer
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.
Labels:
Operating Systems,
Scripting
Subscribe to:
Posts (Atom)






