I've a baby PS script (cut down from the existing time drift PS monitor) that I'm trying to get to take arguments from the powershell monitor. Any help would be appreciated.
The below code works fine when I run it in ISA.
# Argument example: time.nist.gov 13
function PortCheck ([string]$remotesystemname,[int]$port) {
$Socket = $null;
$Socket = New-Object Net.Sockets.TcpClient;
$Socket.Connect($remotesystemname, $Port);
if ($Socket.Connected) {
$stat = 0;
Write-host "Message: Port $port to $remotesystemname is open.";
Write-host "Statistic: $stat";
Exit 0;
}
else {
$stat = 1;
Write-host "Message: Port $port to $remotesystemname is closed.";
Write-host "Statistic: $stat";
Exit 1;
}
}