0

I need to write a .NET (C# or IronPython) console application that starts a program on a remote machine, which reads from the parent's standard input and writes to the parent's standard output. The goal is that input written to the local application gets written to the remote application, and that output from the remote application gets written to the local application's output.

How can I accomplish this? I've looked at WMI, through System.Management, but not sure how to attach the stdin/stdout streams.

aknuds1
  • 65,625
  • 67
  • 195
  • 317

1 Answers1

1

What about using PsExec in your application?

You can open a remote shell using

psexec [params] cmd

and then use the local shell to write input and read output.

Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219
  • I think the OP is looking to create something like a remote shell session, rather than just executing a remote process and tunnelling the output back. You cannot interactively send input to remote processes (i.e. stdin) with PsExec. Good tool though :) – Tim Lloyd Jan 07 '11 at 15:04
  • you can open a remote shell using `psexec [params] cmd`, and then use local shell to input and output. – Daniel Peñalba Jan 07 '11 at 15:09
  • +1 @Daniel I stand corrected. I did not realize you could start interactive sessions with PsExec. I had always just used it to glue build systems together in the past - excellent. :) – Tim Lloyd Jan 07 '11 at 15:18
  • First of all, I am trying to achieve non-interactive control via stdin. Actually, I'm trying to create a command that the Hudson continuous integration server can use to control slave agents, via stdin, as an alternative to SSH on Windows. Secondly, I have already tried PSExec, but I'm not able to make it accept non-interactive input. See my question on the matter: http://stackoverflow.com/questions/4508363/does-psexec-support-input-redirection. – aknuds1 Jan 10 '11 at 09:34