Contact Info

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 PowerShell checks.

Most of the built-in checks have a PowerShell equivalent, implemented as a PowerShell (.ps1) script file. Out-of-the-box, each PowerShell script monitors the same items as the built-in check. Feel free to modify the script.

To add a new PowerShell-based Ping-wmi monitoring check, do the following:

To customize the above monitoring check, click on the 'Edit button' next to the 'Script File' selection box. Notepad will be launched. You can now make changes to the PowerShell script.

Powershell Ping-wmi check

Ping-wmi.ps1 script source code

#################################################################################
# ActiveXperts Network Monitor PowerShell script, (c) ActiveXperts Software B.V.
# For more information about ActiveXperts Network Monitor, visit the ActiveXperts 
# Network Monitor web site at https://www.activexperts.com
#################################################################################
# Script
#      Ping-wmi.ps1
# Description:
#      Ping a remote host.
# Parameters:
#      1) strComputer (string)  - Hostname or IP address of the computer you want to monitor
# Usage:
#      .\Ping-wmi.ps1 '<computer>'
# Sample:
#      .\Ping-wmi.ps1 'localhost'
#################################################################################

# Parameters
param
  (
    [string]$strHost
  )

cls

# Check parameters input
if ( $strHost -eq "" )
{
  $res = "UNCERTAIN: Invalid number of parameters - Usage: .\ping-wmi.ps1 <host | IPaddress>"
  echo $res
  exit
}


#################################################################################
# THE SCRIPT ITSELF
#################################################################################

$objPing = Gwmi Win32_PingStatus -Filter "Address ='$strHost'" | Select-Object StatusCode 
if ( $objPing -eq $null )
{
  $res = "UNCERTAIN: Failed to execute Ping"
  echo $res
  exit
}

#Check if the ping was successfull or not
if ( $objPing.StatusCode -ne 0 )
{ 
  $res = "ERROR: Destination host (" + $strHost + ") unreachble" 
  echo $res
  exit
}

$res = "SUCCESS: Ping to (" + $strHost + ") was successfull" 
echo $res