我正在尝试从UWF_Volume WMI提供程序获取一些数据。请参阅以下链接
https://msdn.microsoft.com/en-us/library/jj979756(v=winembedded.81).aspx
更具体地说,我试图使用以下类来获取排除文件,
dat <- structure(list(date = c("2012-07-02", "2012-07-03", "2012-07-05",
"2012-07-06", "2012-07-09"), X10104 = c(0.003199, 0.005873, Inf,
Inf, -0.002742), X10107 = c(Inf, 0.006545, -0.001951, -0.016775,
-0.006129), X10138 = c(0.001112, 0.001428, -0.01109, -0.009612,
-0.001294), X10145 = c(-0.012178, Inf, Inf, Inf, 0.00583)), .Names = c("date",
"X10104", "X10107", "X10138", "X10145"), class = "data.frame", row.names = c(NA,
-5L))
我不熟悉参数,但从我可以理解的研究中可以作为参考参数。所以我写了以下方法,
UInt32 GetExclusions([out, EmbeddedInstance("UWF_ExcludedFile")] string ExcludedFiles[]);
问题在于行,
public void getUWFExclusions()
{
{
string computer = ".";
ManagementScope scope = new ManagementScope(@"\\" + computer + @"\root\standardcimv2\embedded");
ManagementClass cls = new ManagementClass(scope.Path.Path, "UWF_Volume", null);
foreach (MethodData m in cls.Methods)
{
richTextBox1.AppendText("The class contains this method:" + m.Name + "\n");
}
ManagementBaseObject outParams;
foreach (ManagementObject mo in cls.GetInstances())
{
outParams = mo.InvokeMethod("GetExclusions", null, null);
richtextbox1.appendtext(string.format("ExcludedFiles" + mo[ExcludedFiles]));
}
}
catch (Exception e)
{
richTextBox1.AppendText(e.ToString());
}
}
返回&#34;未找到&#34;
我感谢您帮助调试此问题。
答案 0 :(得分:0)
我猜你错过了通过调用WMI实际获取数据的Object Query。我不确定Windows 8,但直到7我们曾经通过WQL获取数据,而上述代码中没有。