There is a fundamental difference between outputting data using Write-Host and just "leaving info behind":"
Function test {
Write-Host "Result A"
"Result B"
}
Write-Host "Result A"
"Result B"
}
When you run the function, you will get back both results, but Write-Host always directly writes to the console. As such, So you cannot store this result in a variable to process it later.
test
Result A
Result A
Result B
$a = test
$a = test
Result A
$a
Result B
$a
Result B