ConnectionOptions co = new ConnectionOptions();
co.Username = username;
co.Password = password;System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + stringMachineName + "\\root\\cimv2", co);
try
{
ms.Connect();
ManagementPath path = new ManagementPath( "Win32_Process");
ManagementClass processClass = new ManagementClass(ms,path,null);
object[] methodArgs = {"notepad", null, null, 0};
object result = processClass.InvokeMethod("Create", methodArgs);
Console.WriteLine("Creation of process returned: " + result);
}
catch (Exception ex)
{
Console.WriteLine(stringMachineName+"上运行:"+CommandLine+"出错");
} 这里的返回的result如果是0,stringMachineName这台机器上是执行了notepad的。
但是有的机器返回的是3 , 这台机器上是没有实行notepad的 请问这里的result的值哪里可以查到分别代表什么意思???
co.Username = username;
co.Password = password;System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + stringMachineName + "\\root\\cimv2", co);
try
{
ms.Connect();
ManagementPath path = new ManagementPath( "Win32_Process");
ManagementClass processClass = new ManagementClass(ms,path,null);
object[] methodArgs = {"notepad", null, null, 0};
object result = processClass.InvokeMethod("Create", methodArgs);
Console.WriteLine("Creation of process returned: " + result);
}
catch (Exception ex)
{
Console.WriteLine(stringMachineName+"上运行:"+CommandLine+"出错");
} 这里的返回的result如果是0,stringMachineName这台机器上是执行了notepad的。
但是有的机器返回的是3 , 这台机器上是没有实行notepad的 请问这里的result的值哪里可以查到分别代表什么意思???
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货