使用WMI在远程计算机上启动exe文件时出现问题

时间:2018-10-10 08:57:45

标签: c# windows wmi

我在这里关注了一些文章,并设法在远程计算机上启动notepad.exe

我正在尝试启动我们在远程计算机上购买并安装在远程计算机上的第三方软件,但该软件无法运行exe。

object[] theProcessToRun = { @"C:\Program Files (x86)\xyz\xyz.exe" };

var connection = new ConnectionOptions
{
    Username = "username",
    Password = "password",
    Authority = ""ntlmdomain:.local"",
};
var scope = new ManagementScope("\\\\IP\\root\\CIMV2", connection);
scope.Connect();
using (var managementClass = new ManagementClass(scope, new ManagementPath("Win32_Process"), new ObjectGetOptions()))
{
    managementClass.InvokeMethod("Create", theProcessToRun);
}

0 个答案:

没有答案
相关问题