Yesterday one of our "New Delhi PowerShell User Group" member was trying to do the following.

Ping a list of Internet and External Server, and then do the "Trace Route" on the failed ones.  He was facing a problem using "foreach" cmdlets.

to help him i tried to write a script for him and he liked it .. So i think that i should share this script with everyone so that everyone else can be benefitted.

The Script is very easy, you can download the script form here:

This script  doing  Test-Connection to the all Computers in $servers and if test failes then it does
trace route to that Server.

More info about the script : http://newdelhipowershellusergroup.blogspot.in/2012/07/test-connectivity-of-multiple-server.html 


Best Regards!

Aman Dhally 

Come and join my journey of 100 Days of Self Improvement programme: https://www.facebook.com/100DoSI or at www.amandhally.net   

MY PowerShell Blog : http://newdelhipowershellusergroup.blogspot.com/ 

MY Personal Website: www.amandhally.net



Screenshot of the Script.

            "SatNaam WaheGuru"  
Date:     05-July-2012 ; 19:46 
Author: Aman Dhally 
Email:  amandhally@gmail.com 
web:    www.amandhally.net/blog 
blog:    http://newdelhipowershellusergroup.blogspot.com/ 
More Info :  
Version : 1 
    /^(o.o)^\  [Spider Man ]  
$servers = "google.com","hotmail.com","msn.com" 
foreach ( $server in $servers ) { 
        if ((test-Connection -ComputerName $server -Count 2 -Quiet) -eq $true ) {  
            write-Host "$server is alive and Pinging `n " -ForegroundColor Green 
                    } else {  
                    Write-Host "========================= Testing Done for all Servers ========== `n" -ForegroundColor Green 
                    write-Host " `"Computer $server not Pinging, i am going to do traceroute now.`" `n`n" -ForegroundColor RED  
                    Write-Host "========================= Starting Traceroute for $server ========== `n" -ForegroundColor Yellow 
                    tracert -d  $server  
                    Write-Host "========================= Traceroute for $server Done ========== `n" -ForegroundColor Yellow 
    ### ### End of Script