Comments on: VB Script to Find the Uptime of the server on the given machines list in text file/2009/02/28/vb-script-to-find-the-uptime-of-the-server-on-the-given-machines-list-in-text-file/Microsoft Exchange & OWA Resources, Information - Optimize, Support, Manage | How-To | Guides | Reference | AdminTue, 22 Jan 2013 00:11:37 +0000hourly1http://wordpress.com/By: Ritesh/2009/02/28/vb-script-to-find-the-uptime-of-the-server-on-the-given-machines-list-in-text-file/#comment-1164Tue, 22 Jan 2013 00:11:37 +0000/?p=105#comment-1164Use this script;

Set filesys = CreateObject(“Scripting.FileSystemObject”)
Set filetxt1 = filesys.OpenTextFile(“server_details.Txt”,1)

do Until filetxt1.AtEndOfStream
strComputer = filetxt1.Readline
strComputer = trim(strComputer)
set objWMIDateTime = CreateObject(“WbemScripting.SWbemDateTime”)
set objWMI = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
set colOS = objWMI.InstancesOf(“Win32_OperatingSystem”)

for each objOS in colOS
if err.number = 0 Then
objWMIDateTime.Value = objOS.LastBootUpTime
Wscript.Echo strComputer & ” | ” & objWMIDateTime.GetVarDate
Else
Wscript.Echo strComputer & ” | ”
End If
next
Err.clear
Loop

]]>
By: JK/2009/02/28/vb-script-to-find-the-uptime-of-the-server-on-the-given-machines-list-in-text-file/#comment-711Sun, 18 Mar 2012 23:58:15 +0000/?p=105#comment-711HI,

I tried running the script but it fails on Line 2 character 28.

]]>