mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-22 01:48:20 +02:00
Updated ping-remote-hosts.ps1
This commit is contained in:
parent
1bfeb07d51
commit
ebd6e3f1bf
@ -7,7 +7,7 @@
|
|||||||
Specifies the hosts to ping, seperated by commata (10 Internet servers by default)
|
Specifies the hosts to ping, seperated by commata (10 Internet servers by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./ping-remote-hosts.ps1
|
PS> ./ping-remote-hosts.ps1
|
||||||
✅ Online with 0/10 ping loss and 11...40ms latency - 18ms average
|
✅ Online with 11...40ms latency - 18ms average
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -32,11 +32,14 @@ try {
|
|||||||
if ($latency -gt $max) { $max = $latency }
|
if ($latency -gt $max) { $max = $latency }
|
||||||
}
|
}
|
||||||
[int]$loss = $total - $success
|
[int]$loss = $total - $success
|
||||||
if ($success -ne 0) {
|
if ($success -eq 0) {
|
||||||
|
Write-Host "⚠️ Offline ($loss/$total ping loss)"
|
||||||
|
} elseif ($loss -eq 0) {
|
||||||
|
$avg /= $success
|
||||||
|
Write-Host "✅ Online with $($min)...$($max)ms latency - $($avg)ms average"
|
||||||
|
} else {
|
||||||
$avg /= $success
|
$avg /= $success
|
||||||
Write-Host "✅ Online with $loss/$total ping loss and $($min)...$($max)ms latency - $($avg)ms average"
|
Write-Host "✅ Online with $loss/$total ping loss and $($min)...$($max)ms latency - $($avg)ms average"
|
||||||
} else {
|
|
||||||
Write-Host "⚠️ Offline ($loss/$total ping loss)"
|
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user