radius.ps1 - powershell script by ActiveXperts Software
radius.ps1 checks a RADIUS server for accessibility.
Use radius.ps1 directly from ActiveXperts Network Monitor; in the Manager's 'Monitor' menu, select 'New Check (Script)' and select radius.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.
radius.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
# Radius.ps1
# Description:
# Check a RADIUS server for accessibility
# 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 - Host name or IP address of the RADIUS server
# 2) strUser - RADIUS User
# 3) strPassword - Password of the RADIUS user
# 4) strSecret - RADIUS secret
# Usage:
# .\Radius '<Hostname | IP>' '<Username>' '<Password>' '<Secret>'
# Sample:
# .\Radius 'srv202.activexperts-labs.com' 'demo' 'demo' 'AxSecret'
#################################################################################
# -- Declare Parameters
param( [string]$strHost = '', [string]$strUser = '', [string]$strPassword = '', [string]$strSecret = '' )
# -- Use _activexperts.ps1 with common functions
. 'C:\Program Files\ActiveXperts\Network Monitor\Scripts\Monitor (ps1)\_activexperts.ps1'
# Declare local variables by assigning an initial value to it
$objAltCredentials = $null
$strExplanation = ''
cls
$Error.Clear()
# Check parameters input
if( $strHost -eq '' -or $strUser -eq '' -or $strPassword -eq '' -or $strSecret -eq '' )
{
$res = 'UNCERTAIN: Invalid number of parameters - Usage: .\Radius.ps1 "<Hostname | IP>" "<Username>" "<Password>" "<Secret>"'
echo $res
exit
}
#################################################################################
#
# // --- Main script ---
#
#################################################################################
$objRadius = new-object -comobject AxNetwork.Radius
$objRadius.Port = 1812
# Login
$objRadius.CheckAccess( $strHost, $strUser, $strPassword, $strSecret )
if( $objRadius.LastError -eq 0 )
{
$res = 'SUCCESS: RADIUS server accessible'
}
else
{
$res = 'ERROR: Failed to access RADIUS server; result=[' + $objRadius.LastError + ': ' + $objRadius.GetErrorDescription( $objRadius.LastError ) + ']'
}
echo $res
exit
#################################################################################
trap [Exception]
{
$res = "UNCERTAIN: " + $_.Exception.Message
echo $res
exit
}
