Improve check-ping.ps1

This commit is contained in:
Markus Fleschutz 2021-03-30 09:43:58 +02:00
parent 25dd316328
commit 5e1daeea5d

View File

@ -14,9 +14,14 @@ try {
[int]$Max = 0 [int]$Max = 0
[int]$Avg = 0 [int]$Avg = 0
foreach($Ping in $Pings) { foreach($Ping in $Pings) {
if ($Ping.latency -lt $Min) { $Min = $Ping.latency } if ($IsLinux) {
if ($Ping.latency -gt $Max) { $Max = $Ping.latency } [int]$Latency = $Ping.latency
$Avg += $Ping.latency } else {
[int]$Latency = $Ping.time
}
if ($Latency -lt $Min) { $Min = $Latency }
if ($Latency -gt $Max) { $Max = $Latency }
$Avg += $Latency
} }
$Avg = $Avg / $Pings.count $Avg = $Avg / $Pings.count