Running EXE from Deploy.ps1 doesn't show console output in log

I’m executing an EXE (created in .NET) that has Console.WriteLine’s. If I run in interactive mode this output displays on the console. But it never displays in the log. Which means my failure errors from that EXE are never shown. Currently it’s forcing me to keep running in interactive mode.

Hi Nathan,

Can you try calling the exe like this:

$result = & "myapplication.exe" "arg1" "arg2"
write-host $result

Paul

Ok. $result pulls the text out and I can write that back out like you said. I saw some strange stuff with line endings but otherwise that worked.

What worked better was to pipe it to Write-Output

& “myapplication.exe” “arg1” “arg2” | Write-Output

But I’m also wondering if you could employ some trickery so this type of thing isn’t necessary as well as to include stdout and stderr.

http://weblogs.asp.net/soever/archive/2008/12/09/powershell-output-capturing-and-text-wrapping-strange-quirks-solved.aspx

Nathan