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 EventLog 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 EventLog check

EventLog.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
#      EventLog.ps1
# Description:
#     Checks if an event is present into the EventLog
# Parameters:
#     1) strLogName (string)  - Log Name
#     2) strSource (string) - Name of the event
# Usage:
#      .\EventLog.ps1 '<logName>' '<source>' 
# Sample:
#      .\EventLog.ps1 'application' 'AxsNmSvc'
#################################################################################

# Parameters
param
  (
    [string]$strLogName,
    [string]$strSource
  )

cls

# Check paramters input
if ( ([string]$strLogName -eq "") -or ([string]$strSource -eq "") )
{
  echo "UNCERTAIN: Invalid number of parameters - Usage: .\EventLog.ps1 <logName> <source>"
  exit
}


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

Get-Eventlog $strLogName | ForEach-object {
  if ( $_.Source -eq $strSource )
  {
    $succ = "SUCCESS: The Event (" + $strSource + ") was found into (" + $strLogName+")  DATA: 1"
    echo $succ
    exit
  }
}

$err = "ERROR: The Event (" + $strSource + ") was not found into (" + $strLogName+")  DATA: 0"
echo $err