PowerShell.exe can hang if STDIN is redirected - by J. Stangroome

Status : 


Sign in
to vote
ID 572313 Comments
Status Active Workarounds
Type Bug Repros 13
Opened 7/1/2010 5:52:56 PM
Access Restriction Public


The Microsoft.PowerShell.ConsoleHost class constructs a M.PS.WrappedDeserializer passing the STDIN TextReader as one of the parameters. By default, the WrappedDeserializer will call ReadLine() on this STDIN TextReader and wait indefinitely, effectively hanging PowerShell and the calling process.
Sign in to post a comment.
Posted by Greg Borota on 11/17/2012 at 8:34 AM
With this workaround you don't have to use use undocumented features:

powershell.exe -file ScriptFile.ps < CON
Posted by Peter Moberg on 11/21/2010 at 12:40 PM
I have the same problem when executing PowerShell from MSDeploy:


Using the suggested "-inputformat none" seems to resolve the problem.