获取从Linux的远程Windows机器上运行的进程c#

问题描述:

我一直在努力,并搜索了很多,但无法找到适当的支持。 在Mon上运行基于.Net的项目并尝试获取在远程Windows计算机上运行的进程ID。而不能继续... 获取从Linux的远程Windows机器上运行的进程c#

ConnectionOptions connectoptions = new ConnectionOptions();  
string ipAddress = "XX.XX.X.XXX"; 

ManagementScope scope = new ManagementScope(@"\\" + ipAddress + @"\root\cimv2", connectoptions); 
scope.Options = connectoptions; 
var query = new SelectQuery("select * from Win32_process where name = '" + ProcessName + "'"); 
List<int> EPids = new List<int>(); 

using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query)) 
{ 
    foreach (ManagementObject EProcess in searcher.Get()) 
    { 
     var pId = Convert.ToInt32(EngineProcess["ProcessId"]);         
       EnginePids.Add(pId); 
       Console.WriteLine(pId);             
    } 
}   
return EPids.ToArray(); 

scope.Options = connectoptions

我recive一个System.NotImplemented例外。想知道MONO是否真的支持这个?

什么也不在ManagementScope类实现:

System.Management/System.Management/ManagementScope.cs

public ConnectionOptions Options { 
    [MonoTODO] 
    get { 
     throw new NotImplementedException(); 
    } 
    [MonoTODO] 
    set { 
     throw new NotImplementedException(); 
    } 
} 

价:https://github.com/mono/mono/blob/b7a308f660de8174b64697a422abfc7315d07b8c/mcs/class/System.Management/System.Management/ManagementScope.cs