I have actually never found a good, practical use case for it. Not that there isn’t any, it’s just that I personally haven’t come across scenarios where I’d use it. So I don’t really have any observations on it yet
@@PetterTech Thanks for the replay. I've been playing around with all versions of the loop for copying files, and I've tried several different approaches, jobs and what not and the simple foreach () {} seems to be the fastest solution, in my case at least
Certainly! Depends on how the ip adresses you want to loop through are stored, but if you wanted to do a simple ping sweep you could do something like this: 10.13.37.1..255 | foreach {ping 10.13.37.$_ -c 2}
I recently found a love for the foreach method, but the foreach statement is still my go to loop.
Which type of loop is your favorite?
10/10
Nice video. I was wondering what are your observations on ForEach-Object - Parallel {}
I have actually never found a good, practical use case for it. Not that there isn’t any, it’s just that I personally haven’t come across scenarios where I’d use it.
So I don’t really have any observations on it yet
@@PetterTech Thanks for the replay. I've been playing around with all versions of the loop for copying files, and I've tried several different approaches, jobs and what not and the simple foreach () {} seems to be the fastest solution, in my case at least
Can we loop through ip addresses
Certainly! Depends on how the ip adresses you want to loop through are stored, but if you wanted to do a simple ping sweep you could do something like this:
10.13.37.1..255 | foreach {ping 10.13.37.$_ -c 2}