nntp.ps1 - powershell script by ActiveXperts Software
nntp.ps1 establish telnet session to an NNTP news server and validate its response.
Use nntp.ps1 directly from ActiveXperts Network Monitor; in the Manager's 'Monitor' menu, select 'New Check (Script)' and select nntp.ps1. Configure the required parameter, or press 'Load a working sample'.
In ActiveXperts Network Monitor, Administrators can use three different scripting languages: Powershell, VBScript and SSH.
nntp.ps1 script code
#################################################################################
# ActiveXperts Network Monitor PowerShell script, © ActiveXperts Software B.V.
# For more information about ActiveXperts Network Monitor, visit the ActiveXperts
# Network Monitor web site at http://www.activexperts.com
#################################################################################
# Script
# NNTP.ps1
# Description:
# Establish a telnet session to an NNTP news server and validate its response
# NNTP servers always reply a #200# message when ready to establish a session
# This function uses ActiveXperts Network Component.
# 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
# Declare Parameters:
# 1) strHost (string) - Host name or IP address of the news server
# Usage:
# .\NNTP.ps1 '<Hostname | IP>'
# Sample:
# .\NNTP.ps1 'nntp.activexperts-labs.com'
#################################################################################
# -- Declare Parameters
param( [string]$strHost = '' )
# -- Use _activexperts.ps1 with common functions
. 'C:\Program Files\ActiveXperts\Network Monitor\Scripts\Monitor (ps1)\_activexperts.ps1'
#################################################################################
# // --- Main script ---
#################################################################################
# -- Clear screen and clear error
cls
$Error.Clear()
# -- Declare local variables by assigning an initial value to it
$strExplanation = ''
$objAltCredentials = $null
# -- Validate parameters, return on parameter mismatch
if( [string]$strHost -eq '' )
{
$res = 'UNCERTAIN: Invalid number of parameters - Usage: .\NNTP.ps1 <hostname>'
echo $res
exit
}
# Assign return value to $dummy so the return value is hidden in the console
$dummy = AxCheckTelnet $strHost 119 '' '' '' '200' ([ref]$strExplanation)
echo $strExplanation
exit
#################################################################################
# // --- Catch script exceptions ---
#################################################################################
trap [Exception]
{
$res = 'UNCERTAIN: ' + $_.Exception.Message
echo $res
exit
}
