Test-Connection (ping) with PowerShell 7

In one of my previous articles I dedicated myself to the modern version of ping called Test-Connection. I recently discovered that the cmdlet in PowerShell Core 7 offers more parameters than in Windows PowerShell. So I decided to take a deeper look at Test-Connection with PowerShell 7 that I now want to share with you.

My previous article was written some time ago, more precisely in 2017. You can find the article here: The modern version of ping: Test-Connection

Now the time has come to dedicate myself to PowerShell 7 to carry out some awesome things with Test-Connection. If you haven’t installed PowerShell 7 yet, you can easily do it with a one-liner.

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Preview"

Ready? Let’s jump in.


Unlike Windows PowerShell, PowerShell 7 provides the TargetName parameter and the ComputerName parameter to specify the remote host.

Test-Connection -TargetName sid-500.com,



As in Windows PowerShell, you can specify how often the ping will be performed.

Test-Connection -TargetName sid-500.com, -Count 1



Windows PowerShell as well as PowerShell 7 provide omitting the output to show only true or false depending on whether the ping is successful or not.

Test-Connection -TargetName sid-500.com, -Count 1 -Quiet


IPv4 | IPv6

IPv6 is on the rise, so you can specify the protocol.

Test-Connection -TargetName -Count 1 -IPv6


Infinite Ping

Do you remember ping.exe -t ? Here it is with PowerShell 7. The ping is send continously.

Test-Connection -TargetName sid-500.com -Repeat


Resolve DNS Name | Tracert | TraceRoute

The ResolveDestination parametet tries to resolve the DNS-Name. You can either try to retrieve the IP-Adresse (Forward Lookup) or the hostname (Reverse-Lookup).

Watch out line 1. It shows the dns name of

Test-Connection -TargetName -ResolveDestination


Now we go one further. When ResolveDestionation is used along with the TraceRoute parameter, PowerShell tries to resolve the dns name of all the hosts along the way to the target. Wow.

Test-Connection -TargetName -ResolveDestination -Traceroute


Ok, that’s it for today. Have a nice week and see you next time with PowerShell.

1 reply »

  1. I like the “Test-Connection -TargetName -ResolveDestination -Traceroute“ example but in 99% of all cases I am gonna stick with the good old ping 😀

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.