You can’t pipe the result of a foreach loop to anything (which is different from the ForEach-Object cmdlet). There are a couple of ways you could change your code:
I get those two confused STILL(!) at times. Then I look really dumb, lol.
Thanks for the examples! It really helps me understand better when I can compare the different ways to gather the data.
As I said to Richard, I do appreciate it even more when you explain it to me because seeing the solution -with- the explanation of where/why I went wrong.
That seems to be the best way I have found so far to learn Powershell. (I’ve never really been a programmer but I am liking powershell more and more each time I learn something new!)