This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Unable to get PS monitor to take arguments

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;   

             }

}