# 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