我已经尝试了一段时间并且谷歌搜索了很多但是找不到合适的支持。 在Mon上运行基于.Net的项目,并尝试获取在远程Windows机器上运行的进程ID。而且不能继续......
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
我发现了一个System.NotImplemented异常。想知道MONO是否真的支持这个?
答案 0 :(得分:0)
ManagementScope
类中没有实现任何内容:
System.Management/System.Management/ManagementScope.cs
public ConnectionOptions Options {
[MonoTODO]
get {
throw new NotImplementedException ();
}
[MonoTODO]
set {
throw new NotImplementedException ();
}
}