Network Ping Test
This script checks the connectivity of multiple devices by pinging each device listed in a text file (devices.txt). The file should contain one device per line (either an IP address or hostname).
# Path to the file containing device names or IPs
$deviceList = Get-Content -Path "C:\Path\To\devices.txt"
foreach ($device in $deviceList) {
$pingResult = Test-Connection -ComputerName $device -Count 2 -Quiet
if ($pingResult) {
Write-Output "$device is reachable."
} else {
Write-Output "$device is not reachable."
}
}
• Update "C:\Path\To\devices.txt" with the actual path to your file containing the list of devices.
• Explanation: This script pings each device twice and returns either “reachable” or “not reachable” based on the response.
Last updated