I'm looking for the equivalent of the PowerShell pipeline redirection *>&1 when running a job.
I run the jobs roughly like this:
$Instance = [PowerShell]::Create()
$Instance.AddScript($CommandList)
$Result = $Instance.BeginInvoke()
$Instance.EndInvoke($Result)
The trouble is output is divided into multiple streams and to report it I must do this:
$Instance.Streams.Debug
$Instance.Streams.Error
$Instance.Streams.Information
This groups messages by type rather than interleaving them so that there is no good way to tell where, within an execution, a given error was thrown. If they were combined, the errors would appear immediately after relevant Write-Host statements.
There appear to be 5 streams(debug, error, information, progress, verbose and warning) and I'd like to combine them all although simply combining error and information would be a huge step forward.
I looked around the $Instance object and tried to find something under InitialSessionState for passing to Create() with nothing obvious presenting itself.