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 ?
Add comment