Improved ping-internet.ps1

This commit is contained in:
Markus Fleschutz 2024-10-24 17:00:11 +02:00
parent e13ac69220
commit 1bb6efbc76

View File

@ -39,7 +39,12 @@ try {
Write-Host "✅ Online with $loss/$total ping loss and $($min)...$($max)ms latency - $($speed)ms average" Write-Host "✅ Online with $loss/$total ping loss and $($min)...$($max)ms latency - $($speed)ms average"
} else { } else {
[float]$speed = [math]::round([float]$avg / [float]$success, 1) [float]$speed = [math]::round([float]$avg / [float]$success, 1)
Write-Host "✅ Internet ping takes $($speed)ms ($($min)...$($max)ms range)" if ($speed -lt 20.0) { $result = "excellent"
} elseif ($speed -lt 50.0) { $result = "good"
} elseif ($speed -lt 100.0) { $result = "average"
} elseif ($speed -lt 150.0) { $result = "okay"
} else { $result = "laggy" }
Write-Host "✅ Internet ping is $($result): $($speed)ms ($($min)-$($max)ms range)"
} }
exit 0 # success exit 0 # success
} catch { } catch {