neo said:
Nope. For remote stuff, I would use WMI to pull the information.
This link has a WSH/VBScript file that can be modified to possible suit your
needs.
http://groups.google.com/[email protected]
Hi
In the script in the link above I didn't handle the time zone information
correctly, here is an updated version that should work better:
strComputer = "." ' "." for local computer
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer _
& "\root\cimv2")
If Err.Number = 0 Then
On Error Goto 0
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOS in colOperatingSystems
dtmLastBootUpTime = ConvWMIDateTime(objOS.LastBootUpTime, "ISO8601")
dtmSystemUptimeInHours = DateDiff("h", dtmLastBootUpTime, Now)
dtmSystemUptimeInDays = DateDiff("d", dtmLastBootUpTime, Now)
Wscript.Echo "Computer: " & strComputer _
& " started at " & dtmLastBootUpTime
Wscript.Echo "Uptime in hours: " & dtmSystemUptimeInHours
Wscript.Echo "Uptime in days: " & dtmSystemUptimeInDays & vbCrlf
Next
Else
Wscript.Echo "Could not connect to computer with WMI: " _
& strComputer
End If
Function ConvWMIDateTime(sDMTFformat, iNamedFormat)
' Author: Torgeir Bakken
' Modified: 2004-01-16
'
' Converts WMI Date and Time Format to standard date/time
'
' WMI Date and Time Format is documented here:
'
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/date_and_time_format.asp
'
' Arguments ----->
' DMTFformat: Date string in WMI Date and Time Format
'
' iNamedFormat: Optional. Numeric value that indicates the date/time
' format used. If omitted, ISO 8601 is used.
' -1 (and anything <> 0-4) Display in International Date Format ISO8601
' YYYY-MM-DD hh:nn:ss e.g. 2004-01-15 23:50:44
'
' vbGeneralDate 0 Display a date and/or time. If there is a date part,
' display it as a short date. If there is a time part,
' display it as a long time. If present, both parts are
' displayed.
'
' vbLongDate 1 Display a date using the long date format specified in
' your computer's regional settings.
'
' vbShortDate 2 Display a date using the short date format specified in
' your computer's regional settings.
'
' vbLongTime 3 Display a time using the time format specified in your
' computer's regional settings.
'
' vbShortTime 4 Display a time using the 24-hour format (hh:mm).
Dim sYear, sMonth, sDay, sHour, sMinutes, sSeconds
sYear = mid(sDMTFformat, 1, 4)
sMonth = mid(sDMTFformat, 5, 2)
sDay = mid(sDMTFformat, 7, 2)
sHour = mid(sDMTFformat, 9, 2)
sMinutes = mid(sDMTFformat, 11, 2)
sSeconds = mid(sDMTFformat, 13, 2)
' YYYY-MM-DD hh:nn:ss
ConvWMIDateTime = sYear & "-" & sMonth & "-" & sDay & " " _
& sHour & ":" & sMinutes & ":" & sSeconds
If IsNumeric(iNamedFormat) Then
If iNamedFormat >= 0 And iNamedFormat <= 4 Then
' FormatDateTime will set date format to specified format
ConvWMIDateTime = FormatDateTime(ConvWMIDateTime, iNamedFormat)
End If
End If
End Function