Skip to content

Clear-DnsCache

Clears the DNS cache

try {
	$stopWatch = [system.diagnostics.stopwatch]::startNew()

	Clear-DnsClientCache

	[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
	"? DNS cache cleared in $($elapsed)s."
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.