Test Remote IP and Port Similar To Test-NetConnection

I need to see if over 80 servers can connect to a remote ip address and port. I can manually run Test-Netconnection -port on the server to get the results, Is there a similar command I can run in the WebUI Query to get the same results?

I have tried the command below but I get a False result even though the test connection returns a True result.

exists sockets whose (remote port of it = 443 and established of tcp states of it and exists remote address whose (it as string = “162.159.129.83”) of it) of network

Thanks

I could be wrong but I believe what you’re looking at in relevance is more like a netstat command that looks at existing connections on the system and open ports so that you can see if anything is listening or active on a port. I don’t believe that would tell you if the server is actually able to successfully connect to a port. We have typically used test-netconnection or where possible telnet, but it’s not really a good idea to have telnet installed everywhere.

1 Like

I actually did this recently with PowerShell and a task. I have it throwing an exit code and the action then returns Completed or Failed.

$test_connection = Test-NetConnection -ComputerName google.com -Port 443

If ($test_connection.TcpTestSucceeded){
    return 0
    }
else {
    throw 1
}

I do this with a combination of tools. I use the Sysinternals portqry.exe, a batch script and an analysis.

I push out portqry.exe and batch files, use the bat to ping and test the port on the IP you want to check, then the bat file inputs the data into the registry and the analysis reads it.

image

If you want the gist of the bat file I would need some time to sanatize it. It is a little long. You edit the bat script, at the top to input your IPs. I also have one that reads a file of IPs.

Thanks for the responses. It looks like I have a couple good options.