View Single Post
  #5 (permalink)  
Old October 17th, 2003, 04:20 AM
pgtips pgtips is offline
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try this (assuming client.txt contains each server name on a separate line and nothing else)
Code:
Option Explicit
Dim fso, ts, strComputer, colProcesses
Const ForReading = 1
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
' CHANGE THE PATH ON THE NEXT LINE
Set ts = fso.OpenTextFile("path to client.txt", ForReading) 

Do While Not ts.AtEndOfStream 
  strComputer = Trim(ts.ReadLine)
  Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  Set colProcesses = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'clisvcl.exe'")
  If colProcesses.Count = 1 Then
    Wscript.Echo "SMS Client is running on " & strComputer
  Else
    Wscript.Echo "SMS Client is not running on " & strComputer
  End If
Loop

ts.Close
Set ts = Nothing
Set fso = Nothing
Reply With Quote