$names = Get-Content “C:\Temp\ips.txt”
foreach ($name in $names){
if (Test-Connection -Delay 15 -ComputerName $name -Count 1 -ErrorAction SilentlyContinue){
$Output+= “$name,up”
Write-Host “$Name,up” -ForegroundColor Green
}
else{
$Output+= “$name,down”
Write-Host “$Name,down” -ForegroundColor Red
}
}
$Output | Out-file “C:\Temp\ipresult.csv”
![](https://azuresmoke.com/wp-content/uploads/2021/12/ips0.png)