Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

PowerShell - Return first negative foreach result, then continue

$
0
0

Hello,

I created a foreach object as the following, described the easy way.

FOREACH SERVER, TRY PORT, RETURN IF THE PORT IS OPEN OR CLOSED

Lets say it checks 100 server, and the 22nd server says CLOSED : I want it to tell me that and execute some commands

After that, I want it to continue, and give me ALL results (all CLOSED ports on the following 78 servers)

Any ideas?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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