How to capture "legacy" program output in MSH and redirect them to MshHostUserInterface

Tech-Archive recommends: Fix windows errors by optimizing your registry



I am writing a remote Msh host which will redirect all output to
network stream. go to http://mshforfun.blogspot.com/ for details.

I use following code to invoke pipline:

pipe = ServerRunspace.CreatePipeline();
pipe.Commands.AddScript(Input);
pipe.Commands.Add("out-default");
pipe.Commands[0].MergeMyResults(PipelineResultTypes.Error,PipelineResultTypes.Output);
pipe.Invoke();

It works fine for normal msh script. But "legacy" program still write
output directly to Console. For example:
if Input == "ping 127.0.0.1" the out put did not been directed to
MshHostUserInterface.

How to capture "legacy" program output in MSH and redirect them to my
own MshHostUserInterface.

Thanks

.