Process 使用wmi的远程进程,获取返回值

Process 使用wmi的远程进程,获取返回值,process,wmi,return-value,Process,Wmi,Return Value,以下代码连接到远程pc并执行该pc上的进程try.exe string prcToRun = "\"C:\\try.exe\" \"";; object[] theProcessToRun = { prcToRun }; ConnectionOptions theConnection = new ConnectionOptions(); theConnection.Username = "domain\\user"; theConnection.Password = "password.

以下代码连接到远程pc并执行该pc上的进程try.exe

string prcToRun = "\"C:\\try.exe\" \"";;
object[] theProcessToRun = { prcToRun };    
ConnectionOptions theConnection = new ConnectionOptions();
theConnection.Username = "domain\\user";
theConnection.Password = "password.";
ManagementScope theScope = new ManagementScope("\\\\192.168.1.1\\root\\cimv2", theConnection);
ManagementClass theClass = new ManagementClass(theScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());        
theScope.Connect();
theClass.InvokeMethod("Create", theProcessToRun);
它工作得很好,因为“try.exe”实现了我的期望。但是,我希望返回try.exe执行的结果。是否可以使用wmi?至少我需要知道try.exe何时结束,但最好返回一个值。我知道用psexec是可能的,但我不能用它


谢谢

为什么不从
try.exe
发出HTTP请求?您可以将令牌传递给
try.exe
(每台电脑上的每次调用都不同)使用电脑的MAC地址、当前时间(oops、超时)。。。。令牌和执行结果作为querystring参数返回到运行代码的HTTP服务器。