ManagementException:访问Win32_NetworkAdapter时的提供程序加载失败错误

时间:2011-09-13 14:03:05

标签: c# wmi

  

可能重复:
  How can I resolve a “Provider load failure” for WMI requests?

当我尝试访问Win32_NetworkAdapter表时,我得到以下异常:

  

System.Management.ManagementException:提供程序加载失败错误

这就是我尝试访问它的方式:

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)
{
}

这样我也得到了一个例外:

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

当我尝试使用WMI CIM Studio

打开Win32_NetworkAdapter的实例时,我也遇到了同样的错误

造成这种情况的原因是什么?如何才能使其可靠地运作?

0 个答案:

没有答案