Option Explicit On Error Resume Next '--------------- 'Define here : Mail/Sms recipients, critical monitors (separate all of these with ";"), path to the real script '--------------- Const c_MailTo = "SERGIO@POTATO.COM" Const c_SmsTo = "" Const c_CriticalMonitors = "Ping" Const c_VbPath = "wscript /B C:\Vbs\MD-Alerter.vbs" 'Declarations - Pay attention to array size !!! Dim o_Shell, o_Exec, v_CmdLine Dim v_wupInfo(5), v_Info 'Initialisations v_wupInfo(0) = Quote("%ActiveMonitor.Name") v_wupInfo(1) = Quote("%ActiveMonitor.State") v_wupInfo(2) = Quote(Context.GetProperty("TriggerCondition")) v_wupInfo(3) = Quote(Context.GetProperty("DisplayName")) v_wupInfo(4) = Quote("%Device.ActiveMonitorUpNames") v_wupInfo(5) = Quote("%Device.ActiveMonitorDownNames") 'Build the full command line with each parameter enclosed in double quotes v_CmdLine = c_VbPath For v_Info = 0 to 5 v_CmdLine = v_CmdLine & v_wupInfo(v_Info) Next v_CmdLine = v_CmdLine & Quote(c_CriticalMonitors) & Quote(c_MailTo) & Quote(c_SmsTo) If Err Then Context.SetResult 1, "Alert failed : Unable to build parameters" Quit End if 'Run the real script Set o_Shell = CreateObject("WScript.Shell") o_Exec = o_Shell.Run(v_CmdLine, , True) If Err Then Context.SetResult 1, "Alert failed : Unable to run MD-Alerter" Quit End If Select Case o_Exec Case 1 Context.SetResult 0, "All Critical Up" Case 2 Context.SetResult 0, "Non-Critical Up" Case 3 Context.SetResult 0, "Up But Critical Still Down, Skip Alert" Case 4 Context.SetResult 0, "First Critical Down" Case 5 Context.SetResult 0, "Additional Critical Down, Skip Alert" Case 6 Context.SetResult 0, "Non-Critical Down" Case 7 Context.SetResult 0, "Non-Critical Down But Critical Already Down, Skip Alert" Case 8 Context.SetResult 0, "Device Up" Case 9 Context.SetResult 0, "Device Down" Case 100 Context.NotifyProgress "Just Testing" Case 110 context.SetResult 1, "Alert Failed : Bad Or Missing Parameters" Case Else context.SetResult 1, "Alert Failed, Error #" & CStr(o_Exec) End Select Function Quote (p_Str) Quote = " " & Chr(34) & p_Str & Chr(34) & " " End Function