PowerShell script to check TCP port status

Posted on 10 October 2018

Below script to check tcp port is open for remote server as well as local machine

new-object system.net.sockets.tcpclient("127.0.0.1",9090)

IP Address: 127.0.0.1 TCP IP port: 9090

If port is closed, the script will throw error "No connection could be made because the target machine actively refused it 127.0.0.1:9090"

Comment

Leave Comment below.