获取从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();
}
}