mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Renamed to list-dns-servers.ps1 and to Data/public-dns-servers.csv
This commit is contained in:
parent
88f92eb3c7
commit
a40f0cf9c7
@ -1,4 +1,4 @@
|
||||
NAME, IPv4_PRI, IPv4_SEC
|
||||
PROVIDER, IPv4_PRI, IPv4_SEC
|
||||
"AdGuard DNS", 94.140.14.14, 94.140.15.15
|
||||
"CleanBrowsing", 185.228.168.9, 185.228.169.9
|
||||
"Cloudflare (standard)", 1.1.1.1, 1.0.0.1
|
|
@ -48,7 +48,7 @@ Mega Collection of PowerShell Scripts
|
||||
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
||||
| [add-firewall-rules.ps1](Scripts/add-firewall-rules.ps1) | Adds firewall rules for the given executables (needs admin rights). [Read more...](Docs/add-firewall-rules.md) |
|
||||
| [check-cpu.ps1](Scripts/check-cpu.ps1)| Checks the CPU temperature. [Read more...](Docs/check-cpu.md) |
|
||||
| [check-dns.ps1](Scripts/check-dns.ps1) | Checks the DNS resolution. [Read more...](Docs/check-dns.md) |
|
||||
| [check-dns.ps1](Scripts/check-dns.ps1) | Checks the DNS resolution. [Read more...](Docs/check-dns.md) |
|
||||
| [check-drive-space.ps1](Scripts/check-drive-space.ps1) | Checks a drive for free space left. [Read more...](Docs/check-drive-space.md) |
|
||||
| [check-file-system.ps1](Scripts/check-file-system.ps1) | Checks the file system of a drive (needs admin rights). [Read more...](Docs/check-file-system.md)|
|
||||
| [check-health.ps1](Scripts/check-health.ps1) | Checks the system health. [Read more...](Docs/check-health.md) |
|
||||
@ -67,6 +67,7 @@ Mega Collection of PowerShell Scripts
|
||||
| [install-wsl.ps1](Scripts/install-wsl.ps1) | Installs Windows Subsystem for Linux (WSL), needs admin rights. [Read more...](Docs/install-wsl.md)|
|
||||
| [list-apps.ps1](Scripts/list-apps.ps1) | Lists the installed applications. [Read more...](Docs/list-installed-apps.md) |
|
||||
| [list-cli-tools.ps1](Scripts/list-cli-tools.ps1) | Lists installed command-line interface (CLI) tools. [Read more...](Docs/list-cli-tools.md) |
|
||||
| [list-dns-servers.ps1](Scripts/list-dns-servers.ps1) | Lists public DNS servers. [Read more...](Docs/list-dns-servers.md)
|
||||
| [list-drives.ps1](Scripts/list-drives.ps1) | Lists all drives. [Read more...](Docs/list-drives.md) |
|
||||
| [list-network-shares.ps1](Scripts/list-network-shares.ps1) | Lists all network shares of the local computer. [Read more...](Docs/list-network-shares.md) |
|
||||
| [list-installed-software.ps1](Scripts/list-installed-software.ps1) | Lists the installed software (except Windows Store apps). [Read more...](Docs/list-installed-software.md)|
|
||||
|
@ -1,42 +0,0 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Check DNS servers
|
||||
.DESCRIPTION
|
||||
This PowerShell script measures the availability and latency of public DNS servers and lists it.
|
||||
.EXAMPLE
|
||||
PS> ./check-dns-server
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
function CheckDNSServer { param($Name, $IPv4Pri, $IPv4Sec)
|
||||
$SW = [system.diagnostics.stopwatch]::startNew()
|
||||
$null = (nslookup fleschutz.de $IPv4Pri 2>$null)
|
||||
[int]$Elapsed1 = $SW.Elapsed.TotalMilliseconds
|
||||
|
||||
$SW = [system.diagnostics.stopwatch]::startNew()
|
||||
$null = (nslookup fleschutz.de $IPv4Sec 2>$null)
|
||||
[int]$Elapsed2 = $SW.Elapsed.TotalMilliseconds
|
||||
|
||||
New-Object PSObject -Property @{ Name=$Name; IPv4="$IPv4Pri / $IPv4Sec"; Latency="$Elapsed1 / $Elapsed2 ms" }
|
||||
}
|
||||
|
||||
function ListDNSServer {
|
||||
Write-Progress "Loading Data/dns-server-list.csv..."
|
||||
$Table = Import-CSV "$PSScriptRoot/../Data/dns-server-list.csv"
|
||||
Write-Progress "Measuring latency..."
|
||||
foreach($Row in $Table) {
|
||||
CheckDNSServer $Row.NAME $Row.IPv4_PRI $Row.IPv4_SEC
|
||||
}
|
||||
Write-Progress -completed " "
|
||||
}
|
||||
|
||||
try {
|
||||
ListDNSServer | Format-Table -property @{e='Name';width=50},@{e='IPv4';width=32},@{e='Latency';width=15}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
47
Scripts/list-dns-servers.ps1
Executable file
47
Scripts/list-dns-servers.ps1
Executable file
@ -0,0 +1,47 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists DNS servers
|
||||
.DESCRIPTION
|
||||
This PowerShell script measures the latency of public and free DNS servers and lists it.
|
||||
.EXAMPLE
|
||||
PS> ./list-dns-servers
|
||||
|
||||
Provider IPv4 Latency
|
||||
-------- ---- -------
|
||||
AdGuard DNS 94.140.14.14 / 94.140.15.15 222 / 205 ms
|
||||
...
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
function CheckDNSServer { param($Provider, $IPv4Pri, $IPv4Sec)
|
||||
$SW = [system.diagnostics.stopwatch]::startNew()
|
||||
$null = (nslookup fleschutz.de $IPv4Pri 2>$null)
|
||||
[int]$Elapsed1 = $SW.Elapsed.TotalMilliseconds
|
||||
|
||||
$SW = [system.diagnostics.stopwatch]::startNew()
|
||||
$null = (nslookup fleschutz.de $IPv4Sec 2>$null)
|
||||
[int]$Elapsed2 = $SW.Elapsed.TotalMilliseconds
|
||||
|
||||
New-Object PSObject -Property @{ Provider=$Provider; IPv4="$IPv4Pri / $IPv4Sec"; Latency="$Elapsed1 / $Elapsed2 ms" }
|
||||
}
|
||||
|
||||
function List-DNS-Servers {
|
||||
Write-Progress "Loading Data/public-dns-servers.csv..."
|
||||
$Table = Import-CSV "$PSScriptRoot/../Data/public-dns-servers.csv"
|
||||
Write-Progress "Measuring latency..."
|
||||
foreach($Row in $Table) {
|
||||
CheckDNSServer $Row.PROVIDER $Row.IPv4_PRI $Row.IPv4_SEC
|
||||
}
|
||||
Write-Progress -completed " "
|
||||
}
|
||||
|
||||
try {
|
||||
List-DNS-Servers | Format-Table -property @{e='Provider';width=50},@{e='IPv4';width=32},@{e='Latency';width=15}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user