If you need to ping a list of computers or servers,
use this simple Powershell script that reads the list of host names from a .txt file (serverlist.txt file).
It uses the Test-Connection cmdlet to check for the remote computer status.
Copy the following code and save this script as multiping.ps1 .
[powershell]
$ErrorActionPreference = silentlycontinue
$servers = Get-Content D:\Scripts\serverlist.txt
foreach ($_ in $servers) {
$pingtest = Test-Connection -ComputerName $_ -Count 1 -Delay 10 -TimeToLive 10
if ($pingtest.ResponseTime -gt 0)
{"$_ Is Alive" | Out-File -FilePath D:\Scripts\iplist.csv -Append -Force}
else {"$_ Is Down" | Out-File -FilePath D:\Scripts\iplist.csv -Append -Force }
}
[/powershell]
Run this from the Powershell console.
Nice script.
Thanks