I'm creating a script that will get a list of Cluster objects from Active Directory, iterate through them comparing the cluster node names to a name that is input earlier in the script and add the cluster that contains the matching node name to a PSObject. I'm accomplishing this with a nested ForEach loop and the break works great on the internal loop, but the break on the containing ForEach loop just stops the script entirely instead of breaking out of that loop and I'm not sure why. Would someone mind taking a look at my code block and seeing if they can see why that's happening? Thanks!
my old precision t3600 that was my main rig till I got my current build
will post pics of the server soon but here's the drives: (Intel DC-S4500 960gb enterprise grade SATA SSD for boot drive + Ironwolf Pro 14TB)
and my main rig does a backup to this every wed w luckybackup rsync/rclone frontend. mounted locally n added to fstab on the main rig and this t3600 does a nice job as being the backup rig n everything's synced.
Question
Stokkolm
I'm creating a script that will get a list of Cluster objects from Active Directory, iterate through them comparing the cluster node names to a name that is input earlier in the script and add the cluster that contains the matching node name to a PSObject. I'm accomplishing this with a nested ForEach loop and the break works great on the internal loop, but the break on the containing ForEach loop just stops the script entirely instead of breaking out of that loop and I'm not sure why. Would someone mind taking a look at my code block and seeing if they can see why that's happening? Thanks!
Link to comment
https://www.neowin.net/forum/topic/1329964-powershell-break-loop-problem/Share on other sites
1 answer to this question
Recommended Posts