Ping.vbs - Monitoring ICMP Ping availability usage using ActiveXperts Network Monitor
ActiveXperts Network Monitor ships with a powerful set of pre-defined checks. Each individual check has a static number of configuration items. To monitor other items, or to combine monitoring items, you can make use of custom VBScript checks.
Most of the built-in checks have a VBScript equivalent, implemented as a Function in a VBScript (.vbs) file. Out-of-the-box, each VBScript function monitors the same items as the built-in check. Feel free to modify a function. The VBScript check can be customized by editing the VBScript function.
To add a new VBScript-based ICMP Ping monitoring check, do the following:
- On the 'Monitor menu', click 'New Monitoring Check (VBScript)'. The 'VBScript Check' dialog box appears;
- In the 'File selection box', select 'Ping.vbs';
- In the 'Function selection box', select 'Ping';
- In the 'Function parameters group box' enter the required parameters. You can also load a working sample first by clicking on the 'Load a sample, click here' link.
To customize the above monitoring check, click on the 'Edit button' next to the 'File selection box'. Notepad will be launched. You can now make changes to the VBScript function(s).

Ping.vbs script source code
' /////////////////////////////////////////////////////////////////////////////// ' // ActiveXperts Network Monitor - VBScript based checks ' // (c) ActiveXperts Software B.V. ' // ' // For more information about ActiveXperts Network Monitor and VBScript, please ' // visit the online ActiveXperts Network Monitor VBScript Guidelines at: ' // https://www.activexperts.com/support/network-monitor/online/vbscript/ ' // ' /////////////////////////////////////////////////////////////////////////////// ' Option Explicit Const retvalUnknown = 1 Dim SYSDATA, SYSEXPLANATION ' Used by Network Monitor, don't change the names ' /////////////////////////////////////////////////////////////////////////////// ' // To test a function outside Network Monitor (e.g. using CSCRIPT from the ' // command line), remove the comment character (') in the following 5 lines: ' Dim bResult ' bResult = Ping( "www.activexperts.com", 160 ) ' WScript.Echo "Return value: [" & bResult & "]" ' WScript.Echo "SYSDATA: [" & SYSDATA & "]" ' WScript.Echo "SYSEXPLANATION: [" & SYSEXPLANATION & "]" ' //////////////////////////////////////////////////////////////////////////////////////// Function Ping( strComputer, nMaxTimeout ) ' Description: ' Ping a remote host. ' This function uses the Network Component, an ActiveXperts product. ' Network Component is automatically licensed when ActiveXperts Network Monitor is purchased ' For more information about Network Component, see: www.activexperts.com/network-component ' Parameters: ' 1) strComputer As String - Hostname or IP address of the computer you want to ping ' 2) nmaxTimeOut - Timeout in milliseconds ' Usage: ' Ping( "<Hostname | IP>", Timeout_MSecs ) ' Sample: ' Ping( "www.activexperts.com", 160 ) Dim objIcmp Ping = retvalUnknown ' Default return value SYSDATA = "" ' Will hold the response time in milliseconds SYSEXPLANATION = "" ' Set initial value Set objIcmp = CreateObject( "ActiveXperts.Icmp" ) objIcmp.Ping strComputer, 3000 ' Maximum. timeout: 3000 ms If( objIcmp.LastError <> 0 ) Then Ping = False SYSDATA = "" SYSEXPLANATION = objIcmp.GetErrorDescription( objIcmp.LastError ) Exit Function End If If( objIcmp.LastDuration > nMaxTimeout ) Then Ping = False SYSDATA = objIcmp.LastDuration SYSEXPLANATION = "Request from [" & strComputer & "] timed out, time=[" & objIcmp.LastDuration & "ms] (>" & nMaxTimeOut & "ms)" Else Ping = True SYSDATA = objIcmp.LastDuration SYSEXPLANATION = "Reply from " & strComputer & ", time=[" & objIcmp.LastDuration & "ms], TTL=[" & objIcmp.LastTTL & "]" End If End Function