Hi,
Now I am trying "Nslookup" monitoring with scripting. But I cannot execute the script. There is no error message, but it took too long yet noting displayed. But once I run the script the attention about "Windows Script Host" is pop up. Here is my script. Any Idea??
Command line - cmd /c powershell.exe -ExecutionPolicy RemoteSigned .\${FileName}.ps1 ${DeviceName} "ip address"
Script body - $deviceName = $args[0]
$dnsServer = $args[1]
$exitcode = 1
$output = nslookup www.google.com $dnsServer
for($i=0; $1 -lt $output.Length; $i++)
{
$t = $output[$i].Spilt(":")[1]
if($t -ne $null -and $t.Contains($deviceName))
{
$exitcode = 0
break
}
if($exitcode -eq 1)
{
Write-Host Message:Lookup failed for $deviceName
}
else
{
Write-Host Message:Lookup succeeded for $deviceName
}
}
Anyone can help me solve this problem? Many many thanks.
Regards,
Rita