ica.ps1 - powershell script by ActiveXperts Software
ica.ps1 establish a telnet session to an MS ICA Server and validate its response.
Use ica.ps1 directly from ActiveXperts Network Monitor; in the Manager's 'Monitor' menu, select 'New Check (Script)' and select ica.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.
ica.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
# Ica.ps1
# Description:
# Establish a telnet session to a ICA server and validate its response
# ICA servers always reply a #ICA# 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 ICA server
# Usage:
# .\Ica.ps1 '<Hostname | IP>'
#################################################################################
# -- 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()
# -- Validate parameters, return on parameter mismatch
if( $strHost -eq '' )
{
$res = 'UNCERTAIN: Parameter error - Usage: .\Ica.ps1 "<Hostname | IP>"'
echo $res
exit
}
# -- Declare local variables by assigning initial value
$strExplanation = ''
# The result of AxCheckTelnet is assigned to $dummy to prevent Powershell to print the return value
$dummy = AxCheckTelnet $strHost 1494 '' '' '' 'ICA' ([ref]$strExplanation)
echo $strExplanation
exit
#################################################################################
# // --- Catch script exceptions ---
#################################################################################
trap [Exception]
{
$res = 'UNCERTAIN: ' + $_.Exception.Message
echo $res
exit
}
