This neat little thing wil test connection for a list of pingable DNS names (URLS, switches, servers, computers, whatever), and output the result in a list with the objects IP address(es).
If the ICMP ping does not reach the object, it outputs this and jumps to the next object on its list.
Hurray!
cls $servers = gc "C:temppingme.txt" Write-Host write-host "::::::::::::::::::::::::::" Write-host ":: Testing Connectivity ::" write-host "::::::::::::::::::::::::::" Write-Host foreach ($s in $servers) { if(!(Test-Connection -Cn $s -BufferSize 16 -Count 1 -ea 0 -quiet)) {write-host "Problem connecting to $s" -foregroundcolor “yellow”} else {write-host "Connectivity tested OK on $s." "IP:"([System.Net.Dns]::GetHostAddresses($s)) -foregroundcolor “green”}}
– F