site1.erralert.com

← Network monitoring

Ping multiple devices powershell

Pings a list of IPs/hostnames from inside your network and reports which are unreachable. Use this to check LAN-only or VPN-only devices that the public-internet site1.erralert.com checker cannot reach.

Placeholders only. Before running, replace YOUR_URL with your capture endpoint's POST URL . (Open this page from your capture object to have these auto-filled.)
# ping-multiple.ps1 — reachability of internal devices.

$Url     = "YOUR_URL/ping"
$Targets = @(
  "192.168.1.1",    # gateway
  "192.168.1.10",   # nas
  "192.168.1.50"    # printer
)

$Results = @{}
$DownCount = 0
foreach ($t in $Targets) {
  $Ok = Test-Connection -ComputerName $t -Count 1 -Quiet -TimeoutSeconds 2
  $Results[$t] = $Ok
  if (-not $Ok) { $DownCount++ }
}

$Body = (@{
  hostname    = $env:COMPUTERNAME
  targets     = $Results
  down_count  = $DownCount
  total_count = $Targets.Count
}) | ConvertTo-Json -Compress -Depth 4

Invoke-RestMethod -Uri $Url -Method Post -Body $Body `
  -ContentType "application/json" -TimeoutSec 15 | Out-Null

Recommended pairing

Add a capture.value check to this capture object.
json_path = down_count, op = >, threshold = 0 (any device down = alert).

What is the filename?

ping-multiple.ps1 — this is the suggested name for the downloaded file. Rename freely if you prefer.