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 Tftp 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.

Screenshot of a Powershell Tftp check

Tftp.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
#     Tftp.ps1
# Description:
#     Check for file existence on a TFTP host
#     This function uses the ActiveXperts Network Component, an ActiveXperts product.
#     ActiveXperts Network Component is automatically licensed when ActiveXperts 
#     Network Monitor is purchased
#     For more information about ActiveXperts Network Component, see: 
#       www.activexperts.com/network-component
# Parameters:
#     1) strHost - Host name or IP address of the TFTP host
#     2) strFile - The file to check 
# Usage:
#     .\Tftp.ps1 '<Host>' '<File>' 
# Sample:
#     .\Tftp.ps1 '10.1.1.100' '/music/song001.mp3'
#################################################################################

param
  ( 
    [string]$strHost,
    [string]$strFile
  )
  
if ( ( [string]$strHost -eq "" ) -or
     ( [string]$strFile -eq "" )
  )
{
  $res = "UNCERTAIN: Invalid number of parameters - Usage: .\Tftp.ps1 <host> <filename>"
  echo $res
  exit
}
  
$objTftpServer = new-object -comobject ActiveXperts.TftpServer

# Use default port 69
$objTftpServer.HostPort = 69

# Create a temp file to download file to
$objFileSystem = new-object -comobject Scripting.FileSystemObject

$strTempFile = $objFileSystem.GetSpecialFolder(2).Path
$strTempFile += "\"
$strTempfile += $objFileSystem.GetTempName()

# Get file
$objTftpServer.Get( $strHost,$strFile,$strTempFile )

if ( $objTftpServer.LastError -eq 0 )
{
  $res = "SUCCESS: File [" + $strFile + "] found on TFTP host [" + $strHost + "]; size=[" + $objTftpServer.BytesReceived + " bytes]"
  echo $res  
}
else
{
  $res = "ERROR: File [" + $strFile + "] not found on TFTP host; result=[" + $objTftpServer.LastError + "; " + $objTftpServer.GetErrorDescription($objTftpServer.LastError) + "]"
  echo $res
}

if ( $objFileSystem.FileExists( $strTempFile ) )
{
  $objFileSystem.DeleteFile($strTempFile)
}

exit