Runs DNS check on host as defined
This commit is contained in:
parent
461f9d66c9
commit
18b4f0ed0f
|
@ -4,17 +4,17 @@ $hostname = 'bbc.com'
|
||||||
## allowed time for DNS check to be done (Milliseconds)
|
## allowed time for DNS check to be done (Milliseconds)
|
||||||
$time = 100
|
$time = 100
|
||||||
|
|
||||||
write-host -NoNewLine "Verifying" $hostname " ... "
|
write-Output -NoNewLine "Verifying" $hostname " ... "
|
||||||
|
|
||||||
## Do a ping test to ensure hostname can be contacted
|
## Do a ping test to ensure hostname can be contacted
|
||||||
|
|
||||||
if (Test-Connection $hostname -Count 1 -ErrorAction SilentlyContinue)
|
if (Test-Connection $hostname -Count 1 -ErrorAction SilentlyContinue)
|
||||||
{
|
{
|
||||||
write-host "Ping test passed for $hostname"
|
write-Output "Ping test passed for $hostname"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
write-host "Ping Test Failed for $hostname"
|
write-Output "Ping Test Failed for $hostname"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ if($test)
|
||||||
Write-Output "Time taken: $timetaken Milliseconds"
|
Write-Output "Time taken: $timetaken Milliseconds"
|
||||||
if ($timetaken -ge $time)
|
if ($timetaken -ge $time)
|
||||||
{
|
{
|
||||||
write-host "DNS lookup for $hostname took longer than $time Milliseconds"
|
write-Output "DNS lookup for $hostname took longer than $time Milliseconds"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue