Powershell | PING, TRACE,TELNET,NETSTAT | How to use ?

Hey Folks!!!! Hope you all are doing well…

Today we will see how we can replace legacy tools such as ping, trace, Telnet and netstat with Powershell commands. This is relay interesting and am very excited while writing this blog.

So let’s start….

PING (Test-Connection)

Generally, we use the ping command to test the connection between source and destination. But we can leverage Powershell commands to perform the same action.

Below commands test the connection to google.com and 8.8.8.8 (You can replace the same with your IPV4 address OR DNS names)

Test-Connection 8.8.8.8 -Count 5

Test-Connection google.com -Count 3

You can also ping in QUIET mode to get Boolean value (True/False) as shown below

Traceroute: (Test-NetConnection)

We use Traceroute command to check what are the hops the packet flows when originated from source to destination. Below is the command in Powershell we use the check the same.

Telnet (Check whether the port is opened or blocked)

Generally, we use Telnet to check whether a port is opened OR blocked. To do the same via Powershell follow below. Here I have mentioned port 442 to show you a failed connection, you can take any port.

Netstat ( To list all Listen/Established ports )

To see the ports which are listening and having a established connection you can use following command to list out on screen.

Get-NetTCPConnection -State Listen,Established | sort LocalAddress

All right! That’s it for today. Hope you enjoyed. I am sure it will help you in your day to day work.