Are you are working in a windows environment and need to check if a large number of hosts are online? The below ps1 script may be what you are looking for. Place all hostnames to be checked in a text file called computer.txt and on one per line. Modify the script as necessary, then ‘run’ .
# ping-report.ps1
# Limited to < 100 assets in the computerlist.txt file or this will not run!
clear-host
$list = get-content C:\Users\user1\Desktop\computerlist.txt
$UpList = @()
$DownList = @()
$count=0
Foreach($computer in $list) {
$testhost = Test-Connection -ComputerName $computer -count 1 -ErrorAction SilentlyContinue
If ($testhost) {
$UpList += $computer
#Write-Host $computer $testhost.IPV4Address -Foregroundcolor Cyan
$count ++
}
Else {
#Write-Host $computer $testhost.IPV4Address -Foregroundcolor Red
$DownList += $computer
$count ++
}
Write-Progress -Activity "Progess" -Status "$computer Complete:" -percentcomplete $count
};""
#computers that are up
foreach ($computer in $UpList){
Write-Host $computer $list.IPV4Adress -ForegroundColor Cyan
};""
#computers that are down
foreach ($computer in $DownList){
Write-Host $computer -ForegroundColor Red
}