Wednesday, May 11, 2016

PowerShell cmdlet of the Day : Test-Connection


Ping! I can bet, that you use this command almost daily. We use Ping.exe to test networking by pinging IP Addresses or hostnames. If the reply comes then we know networking is working fine and if we get RTO's , then we know, networking is not working.

In PowerShell we have a cmdlet Test-Connection which does the same.

The usage is simple, type the Cmdlet Test-Connection and in -Count parameter provide the numbers of Pings you want to send.

Test-Connection 8.8.8.8 -Count 3

1
Cool!

Actually the most cool thing is , this cmdlet's -Quiet switch parameter.

When we provide the -Quiet parameter, the output comes in True or False ( Awesome!!!). If your  IP/Host is reachable , then the output result will be True, otherwise it will be False.  This comes quite handy when you need to do some network availability checks in to your script.

:)

With Regards.
Aman Dhally

If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery

3 comments:

  1. Should be -Quiet not -Quite for True / False results

    ReplyDelete
  2. thanks Rick, it was typo error, its fixed.

    thanks again,

    ReplyDelete
  3. Thank you for this information.

    ReplyDelete

Note: Only a member of this blog may post a comment.