Background
- PowerShell 3 with SDK
- C# with Framework 4.5
Implementation
I have implemented my own PSHost alogn with PSHostUserInterface. In PSHostUserInterface I override all Write... methods and colleting the to one variable which serves the output.
Problem
In my application I calling Cmdlets which use WriteObject as their output. In the PSHostUserInterface.Write... methods I am getting everything but these WriteObject's output. For example, I see this in regular PowerShell:
This is sample string output from the command
Here we have object from Cmdlet.WriteObject function
This is another string output from the command
This is what I get in my custom PSHost in my application:
This is sample string output from the command
This is another string output from the command
Question
How can I get in C# all the outputs of the Cmdlet?
Many thanks