The code below is useful if you have a large Exchange cluster environment. Now trying to get this code to loop through a list of nodes in a text file then enumerate the output.
'code
'--------------------------------------------------------------------
strComputer = Inputbox("Cluster Node to connect to?")
arrTargetProcs = Array("store.exe")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process")
For Each objProcess in colProcesses
For Each strTargetProc In arrTargetProcs
If LCase(objProcess.Name) = LCase(strTargetProc) Then
MsgBox "Exchange is running therefore this is the active node"
wscript.echo strComputer & "," & " " & "Exchange is running therefore this is the active node"
wscript.quit
End If
Next
Next
MsgBox "Exchange is not running therefore this is the passive node"
'</script>
wscript.echo strComputer & "," & " " & "Exchange is not running therefore this is the passive node"
<message edited by pr on Wednesday, September 01, 2010 2:27 AM>