In order to add value/object to the end of an Array assing using operator "+=" .
# Declare empty array $myArray = @() # Add Elements to the end of the array $myArray += "Banana" $myArray += "Apple" $myArray += "Lemon" # Write Array to host # Convert to string before Write-Host "Write Array to host:`r`n" $tempStr = $myArray | Out-String Write-host $tempStr # Write array piping output Write-Host "`r`nWrite array piping output:`r`n" $myArray | Out-String | Write-Host
PS C:\>
Write Array to host:
Banana
Apple
Lemon
Write array piping output:
Banana
Apple
Lemon