mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-15 12:34:25 +01:00
26 lines
551 B
PowerShell
Executable File
26 lines
551 B
PowerShell
Executable File
<#
|
|
.SYNOPSIS
|
|
Clears the DNS cache
|
|
.DESCRIPTION
|
|
This PowerShell script clears the DNS client 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()
|
|
|
|
Clear-DnsClientCache
|
|
|
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
|
"✔️ cleared DNS cache in $Elapsed ms."
|
|
exit 0 # success
|
|
} catch {
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
exit 1
|
|
}
|