Merge branch 'main' of github.com:fleschutz/PowerShell

This commit is contained in:
Markus Fleschutz 2024-08-22 08:05:16 +02:00
commit 2e75436637
2 changed files with 8 additions and 5 deletions

View File

@ -4588,7 +4588,7 @@ UA,Unit of Action
UAAP,University Athletic Association of the Philippines UAAP,University Athletic Association of the Philippines
UAB,University of Alabama at Birmingham UAB,University of Alabama at Birmingham
UAE,United Arab Emirates (also IOC and FIFA trigram,but not ISO 3166) UAE,United Arab Emirates (also IOC and FIFA trigram,but not ISO 3166)
UAP,Unidentified Areal Phenomana UAP,Unidentified Anomalous Phenomena
UAR,"Uniformly At Random (probability),Unión Argentina de Rugby (Spanish for "Argentine Rugby Union"),United Arab Republic" UAR,"Uniformly At Random (probability),Unión Argentina de Rugby (Spanish for "Argentine Rugby Union"),United Arab Republic"
UAV,"Unmanned Aerial Vehicle,Unprotected Anal and Vaginal sex,UB[edit]" UAV,"Unmanned Aerial Vehicle,Unprotected Anal and Vaginal sex,UB[edit]"
UBC,"United Baptist Church,University of British Columbia" UBC,"United Baptist Church,University of British Columbia"

Can't render this file because it has a wrong number of fields in line 8.

View File

@ -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 {