Consider this simple code:
function Fruits {
Install-WindowsFeature -Name Telnet-Client
return @("apple", "banana", "orange")
}
$FruitArray = @(Fruits)
Output of $FruitArray[0]:
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True Yes Success {}
Output of $FruitArray[1], $FruitArray[2], $FruitArray[3]:
apple
banana
orange
What is happening here? How can I clear the unwanted output from the first element of the array, using return?
Using PowerShell version 5.1, Server 2012 R2.