Need Help on IF Condition..

 


$BooL = 0
foreach($server in (gc .\ADservers.txt)){
if (Test-Connection $server -Count 1 -Quiet) {
Write-host "$Server is able to connect"
$BooL = 1

break


else {
write-host "$Server - Failed"
$BooL = 0
}

}

If ($BooL = 0) {
write-host "None of the Servers mentioned are reachable, The Script will quit..!!"

exit

}
$BooL
Write-Host "Rest of the Script ... :)"

In the above set of code the $BooL value never changes to 1 and Also the If ($BooL = 0) not showing the output.. Can anybody help me on this.. 


  • Edited by R P RAJAN Friday, March 27, 2015 8:47 AM
March 27th, 2015 8:46am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics