Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Removed array Item/s, cannot re-read?

$
0
0

I am quite new to Powershell and Powershell ISE but I am slowlying learning more and more by the day. I am working on a project where I generate a list of names in an array, powershell looks at each one individually, and if the name meets the proper criteria it outputs a message and then removes the name from the array. I then have the program loop to check the list again, until the array is empty, the foreach loop throws an error that the collection was modified cannot enumerate. I have heard that you cannot modify and then re read arrays like this. What are my options?

Thank you.


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

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