Update check-ping.ps1

This commit is contained in:
Markus Fleschutz 2023-09-12 22:07:26 +02:00
parent 7f31a3b98b
commit aa7ae2fff1
2 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@
PS> ./check-network.ps1
N E T W O R K
Firewall enabled
Online with 30ms latency (16ms..56ms, 0/10 loss)
...
.LINK
https://github.com/fleschutz/PowerShell
@ -17,8 +17,8 @@
" "
& "$PSScriptRoot/write-green.ps1" " N E T W O R K"
& "$PSScriptRoot/check-firewall"
& "$PSScriptRoot/check-ping.ps1"
& "$PSScriptRoot/check-firewall"
& "$PSScriptRoot/check-dns.ps1"
& "$PSScriptRoot/check-vpn.ps1"
& "$PSScriptRoot/list-public-ip.ps1"

View File

@ -36,11 +36,11 @@ try {
$lossCount++
}
}
if ($successCount -eq 0) {
Write-Host "⚠️ Offline ($lossCount/$totalCount loss)"
} else {
if ($successCount -ne 0) {
$avg /= $successCount
Write-Host "✅ Ping latency is $($avg)ms average ($($min)ms...$($max)ms, $lossCount/$totalCount loss)"
Write-Host "✅ Online with $($avg)ms ping latency ($($min)ms...$($max)ms, $lossCount/$totalCount loss)"
} else {
Write-Host "⚠️ Offline ($lossCount/$totalCount loss)"
}
exit 0 # success
} catch {