SyntaxFix
Write A Post
Hire A Developer
Questions
To append to an array, just use the += operator.
+=
$Target += $TargetObject
Also, you need to declare $Target = @() before your loop because otherwise, it will empty the array every loop.
$Target = @()