mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Add clear-dns-cache.ps1
This commit is contained in:
parent
7b46ee3503
commit
546c436b3e
@ -7,6 +7,7 @@ aka.ms
|
||||
alternate.de
|
||||
api.dropboxapi.com
|
||||
api.met.no
|
||||
api.serenade.ai
|
||||
api1.origin.com
|
||||
arc.msn.com
|
||||
arte.tv
|
||||
@ -18,6 +19,7 @@ banking.ing-diba.de
|
||||
bing.com
|
||||
bing.de
|
||||
bing.fr
|
||||
bitbucket.org
|
||||
blitzortung.org
|
||||
bolt.dropbox.com
|
||||
catalog.gamepass.com
|
||||
@ -113,6 +115,7 @@ settings.data.microsoft.com
|
||||
settings-win.data.microsoft.com
|
||||
sites.google.com
|
||||
slashdot.com
|
||||
speed.cloudflare.com
|
||||
speedtest.net
|
||||
ssl.gstatic.com
|
||||
stackoverflow.com
|
||||
@ -142,6 +145,7 @@ wttr.in
|
||||
www.google.com
|
||||
www.googleapis.com
|
||||
www.gstatic.com
|
||||
www.heise.de
|
||||
www.netflix.com
|
||||
www.youtube.com
|
||||
youtube.com
|
||||
|
|
26
Scripts/clear-dns-cache.ps1
Normal file
26
Scripts/clear-dns-cache.ps1
Normal file
@ -0,0 +1,26 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Clears the DNS cache
|
||||
.DESCRIPTION
|
||||
This PowerShell script clears the DNS cache of the local computer.
|
||||
.EXAMPLE
|
||||
PS> ./clear-dns-cache
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
$null = (ipconfig /flushdns)
|
||||
if ($lastExitCode -ne "0") { throw "'ipconfig /flushdns' failed with exit code $lastExitCode" }
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ cleared DNS cache in $Elapsed ms."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user