Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

if command not working as expected

$
0
0

The if ($server -match "AMS" -or "BLU" -or "SIN") doesn't seem to work as expected. It executes /zoneadd but I want it to execute /zonedelete since $server bayphxdnsut02 does not match the if condition. Please advise.



foreach ($zone in $bosdzonelist)
{   $server = "bayphxdnsut02"
    if ($server -match "AMS" -or "BLU" -or "SIN") 
    {dnscmd $server /zoneadd $zone /stub IPAddress /file "$zone.dns" | Out-File -append $results}
    else 
    {dnscmd $server /zonedelete $zone /f | Out-File -Append $results}
}


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>