3

Possible Duplicate:
How can I resolve a “Provider load failure” for WMI requests?

Whenver I try to access the Win32_NetworkAdapter table I get the following exception:

System.Management.ManagementException: Provider Load Failure Error

This is how I tried to access it:

ManagementObjectSearcher mos = new ManagementObjectSearcher(
  @"SELECT *  FROM   Win32_NetworkAdapter WHERE  Manufacturer != 'Microsoft' " + 
   "AND NOT PNPDeviceID LIKE 'ROOT\\%'");

var managementObjectList = mos.Get();

// Exception:
foreach (var networkAdapter in managementObjectList)
{
}

This way I get an exception too:

ManagementClass mgmt = new ManagementClass("Win32_NetworkAdapter");
using (ManagementObjectCollection objCol = mgmt.GetInstances())
{
    // Exception:
    foreach (ManagementObject obj in objCol)
    {
    }
}

I am also gettings the same error when I try to open the instances of Win32_NetworkAdapter using WMI CIM Studio

What could be the cause of this and how can I make this reliably work?

Community
  • 1
  • 1
bitbonk
  • 48,890
  • 37
  • 186
  • 278

0 Answers0