Hello,
I am working on some report logging and I want to do a ping test to see if a computer is on or otherwise reachable before I run the rest of the script. My logic looks correct according to the documentation of the Continue statement, but there has to be a mistake somewhere.
Powershell
$Computers=Get-ContentC:\windows\file.txtForeach($Computerin$Computers){#Ping Test. If PC is shut off, script will stop for the current PC in pipeline and move to the next one.$PingRequest=Test-Connection-ComputerName$Computer-Count1-Quietif($PingRequest-eq$false){Continue}#Rest of script....
My comment in the code is what I would like to happen. However, what actually happens is the script will stop when it hits an intentionally bad Computer, thus triggering the continue script block. The script stops and does not move to the next item...