Tagged: output stream redirect
July 22, 2015 at 12:09 pm #27771
I'm finding that, after working for a while in an ISE session, the contents of the output stream stop appearing in the output pane. No errors – just no output. "Write-Output 'test' " produces a blank line. How would I find out if some command / something I've executed has hijacked my output stream, and reset it to appear in the output pane?
July 22, 2015 at 12:22 pm #27772
I am sure you have tried other commands too right?
I would try:
Write-Output "test" > C:\test\test.txt
Write-Host "test" -ForegroundColor Green
See if you get anything in the txt file.
By the way, the file doesn't have to exist, but the folder does.
July 22, 2015 at 12:38 pm #27773
Thanks, i255d. Redirecting Write-Output to a file does result in the output correctly showing up in the file. Write-Host hasn't stopped working – Write-Error and Write-Warning work as well. It's just Write-Output content that doesn't appear and anything that uses that stream.
For example, Get-Help Invoke-Command returns an empty line.
July 23, 2015 at 7:08 am #27806
Anyone seen this behavior at all?
It's very disruptive to my coding and I'd like to get it resolved.
August 3, 2015 at 9:49 am #28144
I've seen this issue myself in recent weeks, on multiple machines. I may have narrowed it down, by chance are you using the PowerShell Transcription GPO? I turned it off on one of my machines, and the problem went away... I turned transcription back on last Friday, and the issue is back today.
August 6, 2015 at 12:05 pm #28246
I'm not familiar with the Transcript GPO. I do make regular use of PS transcripts, though.
June 22, 2016 at 9:37 am #44296
June 22, 2016 at 3:19 pm #44354
No solution, yet, but a possible lead: it seems to happen most consistently in conjunction with executing a script that does a chef-client run from the command line. Like somehow that chef-client run hijacks the console output, so it's going somewhere other than the ISE.
November 22, 2016 at 10:16 am #58417
I've got the same problem. I thought it might be a scope issue because I was testing on a Hyper-V host over RDP. And the script is stored on a file share. So I got on the console of the server (Server 2016), copied the script to the Desktop. Same results. I'm running the ISE as Administrator because I need to manipulate VMs.
The function in question is getting the correct values but I can't retrieve and Write-Output/Write-Host the values from outside function... I've tried 'Return $myvalue' and 'Set-Variable -Name myvalue -Value 'somevalue' -Scope Global' ... same results...
$PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 1 14393 206
You must be logged in to reply to this topic.