I say –  Let’s go all Microsoft ! 😀

Microsoft has enabled us to create our own Applications and Functionalities using Powershell, Moreover it made all our IT experiences manageable from a centralized console.

So idea of using a third party tool sounds a bit old fashioned 😛 to me , Lets make this Blog post a Good Bye to the Tools available over internet to Ping multiple computers in a ‘FANCY‘ manner and make   – ‘One of Our Own’ .

IDEA : 

Tweak the Test-Connection cmdlet available in powershell and make it Presentable with extended functionalities such as ColorsHost Status, Success and Failure Percentage, Number of ICMP Attempts.

HOW IT WORKS :

STEP 1 :  Create a function that accepts Values as an Parameter, just like other Cmdlets.

a1

STEP 2 :  Initialize Array objects that would be used for the Calculation depending upon ICMP response.

a1

STEP 3 :  Run an infinite loop and output the Header row on the screen

a1

STEP 4 :  Now Pass each Hostname to the ForEach Block to test the Connectivity, Calculate and Display the coloured Output depending upon the ping response.

a1

a1

Please note, Quiet switch with Test-Connection only gives $true and $false values depending upon the Ping response.

Test-Connection $_  -Count 1 -Quiet

STEP 5 :  At the end please Pause the script execution for few seconds, so that screen doesn’t gets refreshed with the new values very quickly and are easy on eyes 🙂

a1

HOW TO RUN IT : 

Compile the function once and then you can run this Ping-Host utility in many ways, like in the screenshot below.

a1

OUTPUT : 

Post executing the script you will get coloured output depending upon the ping response you receive from the host.

a1

Click on below link highlighted in GREEN to Auto-Download the complete Powershell script

COMPLETE SCRIPT : Ping-Host

Hopefully this script comes handy to you and useful in maintenance and other troubleshooting purposes.

Happy Reading Folks 🙂