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

C# 使用wmi在远程计算机上启动exe文件时出现问题,c#,windows,wmi,C#,Windows,Wmi,我在这里阅读了一些文章,并设法在远程机器上启动了notepad.exe 我正在尝试启动我们购买的第三方软件,并在远程机器重新启动后安装在远程机器上,但它没有运行exe object[] theProcessToRun = { @"C:\Program Files (x86)\xyz\xyz.exe" }; var connection = new ConnectionOptions { Username = "username", Password = "password",

我在这里阅读了一些文章,并设法在远程机器上启动了
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);
}

问题是?抱歉,刚刚编辑过。记事本很少是一个好的开始工作的例子。这是一个非常简单的程序,很多会使更复杂的程序出错的事情不会发生在记事本上。我做错了什么?我尝试了你的代码,但它也有一个错误。所以我试着用计算机名代替IP。我还删除了权限。然后它成功了。