Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Win32_Processor and Win32_NetworkAdapterConfiguration WMI methods available in Windows 8?

I am testing an existing application in the Windows 8 consumer preview and it crashes upon launching. The log files indicate it is in the method where I do some validation on the CPU ID and Network card details.

To do this, I am calling

        ManagementClass mc = new ManagementClass("Win32_Processor");
        ManagementObjectCollection moc = mc.GetInstances();
        foreach (ManagementObject mo in moc)
        {
            if (cpuInfo.Length == 0)
            {
                // only return cpuInfo from first CPU
                cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
            }
        }

(Note that this application works fine on Windows 7 and earlier).

I then use the same syntax for hooking into Win32_NetworkAdapterConfiguration and getting the IPEnabled, IPAddress[], and MACAddress properties.

But somewhere in here it is crashing.

I have tried to research this already, and found the following Windows 8 server list of WMI classes and methods and the ones I am using are not on it. However, the same site has a list of Windows 7 WMI classes and methods too, and these aren't in that either! (Even though it works on Windows 7 no problem).

So from the look of that, it is not supported.

The MSDN for the ManagementClass indicates that the method is still present in .NET 4.5. Additionally, this Microsoft resource does explicitly list Win32_Processor and Win32_NetworkAdapterConfiguration, with the methods I need.

So, from the links, you can see I have tried to research this, so this is my last stop in trying to solve this mystery.

My app is originally a .NET 2.0 solution created in Visual Studio 2005. I have installed Visual Studio 2011 Beta into my Windows 8 Consumer Preview VM, along with the latest SQL 2012 Express. I have tried importing my project into this Visual Studio but it doesn't load it, telling me that it only supports Metro development. Therefore I cannot debug this issue on the machine itself.

So my question is specifically do these classes exist in Windows 8? If they do, then what am I doing wrong? If they don't, then I need to find out a way to still get this information - but I guess that's a separate question ;-)

like image 265
Mike Avatar asked Mar 20 '12 12:03

Mike


People also ask

What is win32_networkadapterconfiguration in WMI?

The Win32_NetworkAdapterConfiguration WMI classrepresents the attributes and behaviors of a network adapter. This class includes extra properties and methods that support the management of the TCP/IP protocol that are independent from the network adapter.

What is win32_processor WMI class?

The Win32_Processor WMI class represents a device that can interpret a sequence of instructions on a computer running on a Windows operating system. The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties are listed in alphabetic order, not MOF order.

What is the replacement for the Win32\_networkadapter class?

The Win32\_NetworkAdapter class is deprecated. Use the MSFT\_NetAdapter class instead. The Win32\_NetworkAdapterWMI class represents a network adapter of a computer running a Windows operating system. The WMI system classes are a collection of predefined classes based on the Common Information Model (CIM).

What is WMI in Windows 10?

Windows Management Instrumentation (WMI) provides a way of accessing details of your operating system that are normally hidden from the Control Panel, Device manager or IpConfig. While there are 7 WMI classes dealing with network properties, the most versatile is: WMI Class Win32_NetworkAdapterConfiguration.


2 Answers

I can confirm which both WMI classes (Win32_Processor and Win32_NetworkAdapterConfiguration) exist and works under in Windows 8 Developer Preview.

FYI the list which your refear has the title Windows 8 Server WMI Classes with Methods, which means WMI Classes which had methods.

enter image description here

enter image description here

Tool used to check WMI Delphi Code Creator

like image 196
RRUZ Avatar answered Oct 20 '22 21:10

RRUZ


This has been answered but unfortunately only in comments on my original post, by Alex K. Using http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8572 I was able to identify these methods do exist, so I figure it's a coding issue as my code is slightly different to what is generated by that utility.

like image 40
Mike Avatar answered Oct 20 '22 21:10

Mike