How to access WMI method with output array parameter using C#

  • Thread starter Thread starter Sean Liming
  • Start date Start date
S

Sean Liming

Guest
Trying to write a C# Win Forms application that access the properties and methods of UWF WMI provider. For the most part I am able to access most of the properties and methods just fine, but one method has me stumped: GetExclusions. It is supposed to return an array of UWF_ExcludedFiles, which is a class container for FileName. Here is the code so far, cut down a bit:


public void UWFStatus()
{
ManagementScope scope = new ManagementScope(@"root\standardcimv2\embedded");
ManagementClass UWFServicing = new ManagementClass(scope.Path.Path, "UWF_Servicing", null);
ManagementClass UWFVolume = new ManagementClass(scope.Path.Path, "UWF_Volume", null);
ManagementClass UWFEF = new ManagementClass(scope.Path.Path, "UWF_ExcludedFile", null);

//Check to see if servicing is enabled
foreach(ManagementObject mo in UWFServicing.GetInstances())
{
if (mo.GetPropertyValue("ServicingEnabled").ToString() == "True")
{
txtService.Text = "On";
}
else
{
txtService.Text = "Off";
}
}

//File Exclusion list

foreach(ManagementObject mo in UWFVolume.GetInstances())
{
ManagementBaseObject EFresults = mo.InvokeMethod("GetExclusions", null, null);


}
}



What am I supposed o do with EFResults to access the list? Is the some casting to UWF_ExcludedFile? Any help would be appreciated.


Sean Liming - Book Author: Starter Guide SIM (WEI), Pro Guide to WE8S & WES 7, Pro Guide to POS for .NET - www.annabooks.com / www.seanliming.com

Continue reading...
 
Back
Top