How to Ping a List of Computers

Many times It happens that we need to check if a list of computers is active, so how do you ping multiple computers at once?

Use this Powershell script to test connectivity to your list of computers. it will produce two lists of Bad (unresponsive) and Good(Responsive) computers.

You need to change “D:\scripts\list.txt” to the path where your saved your computers list.

Also, you can un-comment  #Write-Host $name… to view the list if computers with different colors

$Mylist = Get-Content D:\scripts\list.txt
[System.Collections.ArrayList]$GoodArrayList = @()
[System.Collections.ArrayList]$BadArrayList = @()

foreach ($name in $Mylist){
  if (Test-Connection -ComputerName $name -Count 1 -ErrorAction SilentlyContinue){
    #Write-Host $name -ForegroundColor Cyan
    #Write-Host $name "down" -ForegroundColor Red
Write-Host -ForegroundColor Cyan "Good"
Write-Host -ForegroundColor Red "BAd"

Leave a Reply