title: PSExec: Redirecting C# console app output to window/Diagnostics.Process?
body: <p>So I've written a C# console app that spits stuff to the console (in my case, some XML). Now I'm calling that console app from another machine using PsExec; the call works fine and exits with error code 0 (meaning success), however, I cannot retrieve/see the output written to the command line standard output by my console app.</p>
  
  <p>My call looks something like:</p>
  
  <pre><code>"C:\Program Files\PSTools\psexec.exe"
      &lt;machineName&gt;
      -u &lt;user&gt;
      -p &lt;password&gt;
      "C:\..\..\consoleapp.exe"
      -arg1 "value"
  </code></pre>
  
  <p>I've noticed that when I run this, it pops open a second window other than the psexec window (that presumably is my console app) that opens and closes very fast. I've tried adding the -i flag, the 2>&amp;1, >>C:output.txt, and >C:\output.txt redirects, none which get my console app output to appear in the original console window [that has psexec in it], nor dump my console app output to file.</p>
  
  <p>This is an intermediate goal however, I'm trying to redirect this output into a System.Diagnostics.Process object, which has only managed to redirect just the psexec output to stderror (i.e. "PSexec connecting to... exited with code 0"). The stdout is blank, which I'd like to contain my console app output.</p>
  
  <p>Any suggestions?</p>