mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-16 15:41:52 +02:00
Updated the manuals
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
Script: *check-dns.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script measures the DNS resolution speed (using 100 popular domains) and prints it.
|
||||
This PowerShell script measures the DNS resolution speed using 100 internet domains and prints it.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-dns.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-dns.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-dns.ps1
|
||||
✅ DNS resolves 56.5 domains per second
|
||||
✅ Internet DNS lookups in 33.6ms
|
||||
|
||||
```
|
||||
|
||||
@ -36,10 +36,10 @@ Script Content
|
||||
.SYNOPSIS
|
||||
Check the DNS resolution
|
||||
.DESCRIPTION
|
||||
This PowerShell script measures the DNS resolution speed (using 100 popular domains) and prints it.
|
||||
This PowerShell script measures the DNS resolution speed using 100 internet domains and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-dns.ps1
|
||||
✅ DNS resolves 56.5 domains per second
|
||||
✅ Internet DNS lookups in 33.6ms
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,24 +47,21 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
#Write-Progress "Measuring DNS resolution..."
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-domains.csv"
|
||||
$numRows = $table.Length
|
||||
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
if ($IsLinux) {
|
||||
foreach($row in $table){$nop=dig $row.Domain +short}
|
||||
} else {
|
||||
Clear-DnsClientCache
|
||||
foreach($row in $table){$nop=Resolve-DNSName $row.Domain}
|
||||
}
|
||||
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
|
||||
#Write-Progress -completed "Measuring DNS resolution..."
|
||||
$average = [math]::round($numRows / $elapsed, 1)
|
||||
if ($average -lt 10.0) {
|
||||
Write-Host "⚠️ DNS resolves $average domains per second only"
|
||||
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds * 1000.0
|
||||
$speed = [math]::round($elapsed / $table.Length, 1)
|
||||
if ($speed -gt 100.0) {
|
||||
Write-Host "⚠️ Internet DNS lookups take $($speed)ms!"
|
||||
} else {
|
||||
Write-Host "✅ DNS resolves $average domains per second"
|
||||
Write-Host "✅ Internet DNS lookups in $($speed)ms"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -73,4 +70,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
Reference in New Issue
Block a user