mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-08 00:29:11 +02:00
Update check-dns.ps1 and check-ping.ps1
This commit is contained in:
parent
7dc18b5b00
commit
91526bd1ee
@ -13,7 +13,7 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Progress "⏳ Resolving 200 popular domains..."
|
Write-Progress "⏳ Resolving 200 popular domain names..."
|
||||||
$table = Import-CSV "$PSScriptRoot/../Data/popular-domains.csv"
|
$table = Import-CSV "$PSScriptRoot/../Data/popular-domains.csv"
|
||||||
$numRows = $table.Length
|
$numRows = $table.Length
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
Specifies the hosts to check, seperated by commata (default is: amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com)
|
Specifies the hosts to check, seperated by commata (default is: amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-ping
|
PS> ./check-ping
|
||||||
✅ Ping latency is 13ms...109ms, 25ms average.
|
✅ Ping latency is 13ms...109ms with 25ms average.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -20,7 +20,6 @@ try {
|
|||||||
Write-Progress "⏳ Sending a ping to 9 popular hosts..."
|
Write-Progress "⏳ Sending a ping to 9 popular hosts..."
|
||||||
$HostsArray = $hosts.Split(",")
|
$HostsArray = $hosts.Split(",")
|
||||||
$Pings = Test-Connection -computerName $HostsArray -count 1
|
$Pings = Test-Connection -computerName $HostsArray -count 1
|
||||||
Write-Progress -Completed "."
|
|
||||||
|
|
||||||
[int]$Min = 9999999
|
[int]$Min = 9999999
|
||||||
[int]$Max = [int]$Avg = 0
|
[int]$Max = [int]$Avg = 0
|
||||||
@ -31,7 +30,9 @@ try {
|
|||||||
$Avg += $Latency
|
$Avg += $Latency
|
||||||
}
|
}
|
||||||
$Avg /= $Pings.count
|
$Avg /= $Pings.count
|
||||||
Write-Host "✅ Ping latency is $($Min)ms...$($Max)ms, $($Avg)ms average"
|
|
||||||
|
Write-Progress -Completed "."
|
||||||
|
Write-Host "✅ Ping latency is $($Min)ms...$($Max)ms with $($Avg)ms average"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user