What's the best way to run a process remotely with capturing the output ?
Posted
by Homam
on Stack Overflow
See other posts from Stack Overflow
or by Homam
Published on 2010-06-12T13:12:56Z
Indexed on
2010/06/12
13:22 UTC
Read the original article
Hit count: 253
Hi all,
I have a windows service responsible for running processes on a remote machine with capturing the output,
I googled for that and read a lot of articles and threads,
I found two ways:
1) using WMI for call the remote process like this example: http://www.codeproject.com/KB/cs/EverythingInWmi02.aspx
2) using the PsExec tool by System.Diagnostic.Process class
ever way of these has many problems,
the WMI doesn't support returning the output and doesn't support "WaitingToExit" It just call the process and return the PId,
and the PsExec couldn't capture the output programmatically by System.Diagnostic.Process in a clear way, I found only workarounds like redirect the output to a file then read the redirected file..etc,
I need a real solution please
© Stack Overflow or respective owner