PowerShell - Simple Test-Connection from text list
- Jon Boyette
- Jan 7, 2022
- 1 min read
ForEach ($COMPUTER in (gc c:\temp\yourfile.txt))
{if(!(Test-Connection -Cn $computer -BufferSize 16 -Count 1 -ea 0 -quiet))
{write-host "Cannot Reach $computer" -f Cyan}
else {
Test-Connection -ComputerName $computer -Count 1
}
}
Save that as a ps1, or copy and paste, build a text file with per line machine name.
Comments