I\'ve learned from this Stack Overflow question, that PowerShell return semantics are different, let\'s say, from C#\'s return semantics. Quote from the aforementioned quest
You could replace echo (alias of Write-Output) with Write-Host:
echo
PS> function test{ Write-Host "foo";"bar"} PS> $a = test test PS >$a bar