Skip to content

Instantly share code, notes, and snippets.

@CJHarmath
Created March 15, 2020 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CJHarmath/52bd076e40032abb80a3d43aa40183e4 to your computer and use it in GitHub Desktop.
Save CJHarmath/52bd076e40032abb80a3d43aa40183e4 to your computer and use it in GitHub Desktop.
DNS Resolve Test
function Test-DnsResolve($name, $server) {
<#
.SUMMARY
DNS Resolver tester
.PARAMETER Name
The host name to resolve
.PARAMETER Server
The DNS Server to be used
#>
$lastIp = $null
while($true) {
& ipconfig /flushdns | out-null
$resolved = (Resolve-DnsName $name -server $server).IpAddress
if ($lastIp -ne $resolved) {
Write-Host $resolved
(Invoke-RestMethod "https://geolocation-db.com/jsonp/$resolved")
$lastIp = $resolved
}
start-sleep -Seconds 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment