mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-14 14:58:47 +02:00
Renamed folder Scripts to scripts
This commit is contained in:
26
scripts/clear-dns-cache.ps1
Executable file
26
scripts/clear-dns-cache.ps1
Executable file
@ -0,0 +1,26 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Clears the DNS cache
|
||||
.DESCRIPTION
|
||||
This PowerShell script clears the DNS client cache of the local computer.
|
||||
.EXAMPLE
|
||||
PS> ./clear-dns-cache.ps1
|
||||
✔️ Cleared DNS cache in 1 sec
|
||||
.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 sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Reference in New Issue
Block a user