I am trying to use new WMI-class in Windows 8 MSFT_NetAdapter
instead of Win32_NetworkAdapter
using System;
using System.Management;
namespace TestAdapters
{
class Program
{
static void Main(string[] args)
{
string query = "SELECT * From MSFT_NetAdapter";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
ManagementObjectCollection adaptersCollection = searcher.Get();
foreach (ManagementObject adapterWmiObject in adaptersCollection) //System.Management.ManagementException
{
//...
}
Console.WriteLine("end.");
Console.ReadKey();
}
}
}
And I get an System.Management.ManagementException
on the the foreach
statement with message: Invalid class
I don't know, what does it mean. I compiled and ran code under Windows 8.1 x64, so this class must work.
How to use MSFT_NetAdapter
?