Hi,
I have a problem with PS script that is checking if port on remote host is open or not. I'm executing this script with Custom EXE/Script sensor and it is working but always giving the 1:ERROR value, below you will find the code :
try
{
$tcp=new-object System.Net.Sockets.TcpClient
$tcp.connect("10.10.10.10",445)
Write-Host "0:OK"
$tcp.close()
}
catch
{
Write-Host "1:ERROR"
}
Script is working fine with "Invoke command" from Powershell console and its giving the correct value.
Someone ?
Article Comments
Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.
Why not use the integrated port sensor?
Mar, 2016 - Permalink