wmi调用远程机下bat怎么不执行?
代码如下
string strCommand = @"1.bat";
strCommand = string.Format(strCommand, domainComputer.computerName);
string remoteMachine = domainComputer.computerName;//电脑名
ManagementScope manScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", remoteMachine), co);
manScope.Connect();
ObjectGetOptions objectGetOptions = new ObjectGetOptions();
ManagementPath managementPath = new ManagementPath("Win32_Process");
ManagementClass processClass = new ManagementClass(manScope, managementPath, objectGetOptions);
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
inParams["CommandLine"] = strCommand;
inParams["CurrentDirectory"] = @"C:\Test\1\";
ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
String outMess = "Creation of the process returned: " + outParams["returnValue"] + "\n";
outMess = outMess + "Process ID: " + outParams["processId"];
执行完processId 是有值的,但是实际没产生效果,我的bat是写文件,但是实际没写,双击执行bat会写文件的...为什么? --------------------编程问答-------------------- PsExec v2.0
http://technet.microsoft.com/en-us/sysinternals/bb897553
补充:.NET技术 , C#