I’ve got a few functions that return an array of PsCustomObjects, and returning other stuff would be bad.
Yet, at times, I’d like to pass in -Verbose and spit out some information to the host (using Write-Host). I can easily implement Test-Verbose, but when I want to spit out a table (with Format-Table), it’s not as easy as capturing the output and piping it to Write-Host.
What is the right way to show the output of Format-Table to the host, without sending it to the stdout, where it will be tallied as part of the function’s return values?
For example:
$objects | Format-Table | Write-Host
Thanks!!