I'm wanting to know if it's possible to get the stream that refers to the Powershell console window (in Powershell), assuming one exists. For example, in C# .NET it would be done simply by Console.OpenStandardOutput(). Is there an equivalent in Powershell?
What I'm looking to do is create a System.IO.BinaryWriter to write to it instead of using Write-Host or the like, mostly for experimentation.
I've tried [Console]::OpenStandardOutput(), but that gives me an empty stream, making me think a different one is in use for Powershell.
I'm working with Powershell V5.0:
Major Minor Build Revision
----- ----- ----- --------
5 0 10240 16384
.Lengthto see what was in it at the time after I got it. Since the screen was covered in basic pipeline output, I figured it shouldn't be empty. I don't know if it makes a difference that I'm using the ISE, though.