Add clear-dns-cache.ps1

This commit is contained in:
Markus Fleschutz 2022-05-09 16:18:05 +02:00
parent 7b46ee3503
commit 546c436b3e
2 changed files with 30 additions and 0 deletions

View File

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

1 Domain
7 alternate.de
8 api.dropboxapi.com
9 api.met.no
10 api.serenade.ai
11 api1.origin.com
12 arc.msn.com
13 arte.tv
19 bing.com
20 bing.de
21 bing.fr
22 bitbucket.org
23 blitzortung.org
24 bolt.dropbox.com
25 catalog.gamepass.com
115 settings-win.data.microsoft.com
116 sites.google.com
117 slashdot.com
118 speed.cloudflare.com
119 speedtest.net
120 ssl.gstatic.com
121 stackoverflow.com
145 www.google.com
146 www.googleapis.com
147 www.gstatic.com
148 www.heise.de
149 www.netflix.com
150 www.youtube.com
151 youtube.com

View 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
}