I don\'t have much PowerShell experience yet and am trying to teach myself as I go along.
I\'m trying to make some proof of concept code for a bigger project. The main g
Instead of re-creating the array in each loop iteration (which is basically what's happening each time you add to it), assign the result of the the loop to a variable:
$testArray = foreach($item in $tempArray) { addToArray $item }