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.

Win32_NetworkAdapter only supplies IPv4 data. For more information, see IPv6 and IPv4 Support in WMI.

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.

Syntax

[Dynamic, Provider("CIMWin32"), UUID("{8502C4C0-5FBB-11D2-AAC1-006008C78BC7}"), AMENDMENT]
class Win32_NetworkAdapter : CIM_NetworkAdapter
{
  string   AdapterType;
  uint16   AdapterTypeID;
  boolean  AutoSense;
  uint16   Availability;
  string   Caption;
  uint32   ConfigManagerErrorCode;
  boolean  ConfigManagerUserConfig;
  string   CreationClassName;
  string   Description;
  string   DeviceID;
  boolean  ErrorCleared;
  string   ErrorDescription;
  string   GUID;
  uint32   Index;
  datetime InstallDate;
  boolean  Installed;
  uint32   InterfaceIndex;
  uint32   LastErrorCode;
  string   MACAddress;
  string   Manufacturer;
  uint32   MaxNumberControlled;
  uint64   MaxSpeed;
  string   Name;
  string   NetConnectionID;
  uint16   NetConnectionStatus;
  boolean  NetEnabled;
  string   NetworkAddresses[];
  string   PermanentAddress;
  boolean  PhysicalAdapter;
  string   PNPDeviceID;
  uint16   PowerManagementCapabilities[];
  boolean  PowerManagementSupported;
  string   ProductName;
  string   ServiceName;
  uint64   Speed;
  string   Status;
  uint16   StatusInfo;
  string   SystemCreationClassName;
  string   SystemName;
  datetime TimeOfLastReset;
};

Members

The Win32_NetworkAdapter class has these types of members:

Methods

The Win32_NetworkAdapter class has these methods.

Method Description
Disable Disables the network adapter.
Enable Enables the network adapter.
Reset Not implemented. For more information about how to implement this method, see the Reset method in CIM_NetworkAdapter.
SetPowerState Not implemented. For more information about how to implement this method, see the SetPowerState method in CIM_NetworkAdapter.

 

Properties

The Win32_NetworkAdapter class has these properties.

AdapterType

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("DeviceIoControl::OID_GEN_MEDIA_IN_USE")

Network medium in use. The network adapters are as follows:

Ethernet 802.3 ("Ethernet 802.3")

Token Ring 802.5 ("Token Ring 802.5")

Fiber Distributed Data Interface (FDDI) ("Fiber Distributed Data Interface (FDDI)")

Wide Area Network (WAN) ("Wide Area Network (WAN)")

LocalTalk ("LocalTalk")

Ethernet using DIX header format ("Ethernet using DIX header format")

ARCNET ("ARCNET")

ARCNET (878.2) ("ARCNET (878.2)")

ATM ("ATM")

Wireless ("Wireless")

Infrared Wireless ("Infrared Wireless")

Bpc ("Bpc")

CoWan ("CoWan")

1394 ("1394")

AdapterTypeID

Data type: uint16

Access type: Read-only

Qualifiers: MappingStrings ("DeviceIoControl::OID_GEN_MEDIA_IN_USE")

Network medium in use. Returns the same information as the AdapterType property, except that the information is in the form of an integer.

Ethernet 802.3 (0)

Token Ring 802.5 (1)

Fiber Distributed Data Interface (FDDI) (2)

Wide Area Network (WAN) (3)

LocalTalk (4)

Ethernet using DIX header format (5)

ARCNET (6)

ARCNET (878.2) (7)

ATM (8)

Wireless (9)

Infrared Wireless (10)

Bpc (11)

CoWan (12)

1394 (13)

AutoSense

Data type: boolean

Access type: Read-only

If True, the network adapter can automatically determine the speed of the attached or network media.

This property is inherited from CIM_NetworkAdapter.

This property has not been implemented yet. It returns a NULL value by default.

Availability

Data type: uint16

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|Operational State|003.5", "MIB.IETF|HOST-RESOURCES-MIB.hrDeviceStatus")

Availability and status of the device.

This property is inherited from CIM_LogicalDevice.

Other (1)

Unknown (2)

Running/Full Power (3)

Running or Full Power

Warning (4)

In Test (5)

Not Applicable (6)

Power Off (7)

Off Line (8)

Off Duty (9)

Degraded (10)

Not Installed (11)

Install Error (12)

Power Save - Unknown (13)

The device is known to be in a power save state, but its exact status is unknown.

Power Save - Low Power Mode (14)

The device is in a power save state, but still functioning, and may exhibit degraded performance.

Power Save - Standby (15)

The device is not functioning, but could be brought to full power quickly.

Power Cycle (16)

Power Save - Warning (17)

The device is in a warning state, though also in a power save state.

Paused (18)

The device is paused.

Not Ready (19)

The device is not ready.

Not Configured (20)

The device is not configured.

Quiesced (21)

The device is quiet.

Caption

Data type: string

Access type: Read-only

Qualifiers: MaxLen (64), DisplayName ("Caption")

Short description of the object—a one-line string.

This property is inherited from CIM_ManagedSystemElement.

ConfigManagerErrorCode

Data type: uint32

Access type: Read-only

Qualifiers: Schema ("Win32")

Windows Configuration Manager error code.

This property is inherited from CIM_LogicalDevice.

This device is working properly. (0)

Device is working properly.

This device is not configured correctly. (1)

Device is not configured correctly.

Windows cannot load the driver for this device. (2)

The driver for this device might be corrupted, or your system may be running low on memory or other resources. (3)

Driver for this device might be corrupted, or the system may be low on memory or other resources.

This device is not working properly. One of its drivers or your registry might be corrupted. (4)

Device is not working properly. One of its drivers or the registry might be corrupted.

The driver for this device needs a resource that Windows cannot manage. (5)

Driver for the device requires a resource that Windows cannot manage.

The boot configuration for this device conflicts with other devices. (6)

Boot configuration for the device conflicts with other devices.

Cannot filter. (7)

The driver loader for the device is missing. (8)

Driver loader for the device is missing.

This device is not working properly because the controlling firmware is reporting the resources for the device incorrectly. (9)

Device is not working properly. The controlling firmware is incorrectly reporting the resources for the device.

This device cannot start. (10)

Device cannot start.

This device failed. (11)

Device failed.

This device cannot find enough free resources that it can use. (12)

Device cannot find enough free resources to use.

Windows cannot verify this device's resources. (13)

Windows cannot verify the device's resources.

This device cannot work properly until you restart your computer. (14)

Device cannot work properly until the computer is restarted.

This device is not working properly because there is probably a re-enumeration problem. (15)

Device is not working properly due to a possible re-enumeration problem.

Windows cannot identify all the resources this device uses. (16)

Windows cannot identify all of the resources that the device uses.

This device is asking for an unknown resource type. (17)

Device is requesting an unknown resource type.

Reinstall the drivers for this device. (18)

Device drivers must be reinstalled.

Failure using the VxD loader. (19)

Your registry might be corrupted. (20)

Registry might be corrupted.

System failure: Try changing the driver for this device. If that does not work, see your hardware documentation. Windows is removing this device. (21)

System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device.

This device is disabled. (22)

Device is disabled.

System failure: Try changing the driver for this device. If that doesn't work, see your hardware documentation. (23)

System failure. If changing the device driver is ineffective, see the hardware documentation.

This device is not present, is not working properly, or does not have all its drivers installed. (24)

Device is not present, not working properly, or does not have all of its drivers installed.

Windows is still setting up this device. (25)

Windows is still setting up the device.

Windows is still setting up this device. (26)

Windows is still setting up the device.

This device does not have valid log configuration. (27)

Device does not have valid log configuration.

The drivers for this device are not installed. (28)

Device drivers are not installed.

This device is disabled because the firmware of the device did not give it the required resources. (29)

Device is disabled. The device firmware did not provide the required resources.

This device is using an Interrupt Request (IRQ) resource that another device is using. (30)

Device is using an IRQ resource that another device is using.

This device is not working properly because Windows cannot load the drivers required for this device. (31)

Device is not working properly. Windows cannot load the required device drivers.

ConfigManagerUserConfig

Data type: boolean

Access type: Read-only

Qualifiers: Schema ("Win32")

If True, the device is using a user-defined configuration.

This property is inherited from CIM_LogicalDevice.

CreationClassName

Data type: string

Access type: Read-only

Qualifiers: CIM_Key

Name of the first concrete class to appear in the inheritance chain used in the creation of an instance. When used with the other key properties of the class, the property allows all instances of this class and its subclasses to be uniquely identified.

This property is inherited from CIM_LogicalDevice.

Description

Data type: string

Access type: Read-only

Qualifiers: DisplayName ("Description")

Description of the object.

This property is inherited from CIM_ManagedSystemElement.

DeviceID

Data type: string

Access type: Read-only

Qualifiers: Key, Override ("DeviceId"), MappingStrings ("Win32Registry|System\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}")

Unique identifier of the network adapter from other devices on the system.

This property is inherited from CIM_LogicalDevice.

ErrorCleared

Data type: boolean

Access type: Read-only

If True, the error reported in LastErrorCode is now cleared.

This property is inherited from CIM_LogicalDevice.

ErrorDescription

Data type: string

Access type: Read-only

More information about the error recorded in LastErrorCode, and information about any corrective actions that may be taken.

This property is inherited from CIM_LogicalDevice.

GUID

Data type: string

Access type: Read-only

Globally unique identifier for the connection.

Index

Data type: uint32

Access type: Read-only

Qualifiers: MappingStrings ("Win32Registry|System\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}")

Index number of the network adapter, stored in the system registry.

Example: 0

InstallDate

Data type: datetime

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|ComponentID|001.5"), DisplayName ("Install Date")

Date and time the object was installed. This property does not need a value to indicate that the object is installed.

This property is inherited from CIM_ManagedSystemElement.

This property has not been implemented yet. It returns a NULL value by default.

Installed

Data type: boolean

Access type: Read-only

Qualifiers: DEPRECATED, MappingStrings ("Win32Registry|Software\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards|DriverDate")

If True, the network adapter is installed in the system.

InterfaceIndex

Data type: uint32

Access type: Read-only

Index value that uniquely identifies the local network interface. The value in this property is the same as the value in the InterfaceIndex property in the instance of Win32_IP4RouteTable that represents the network interface in the route table.

LastErrorCode

Data type: uint32

Access type: Read-only

Last error code reported by the logical device.

This property is inherited from CIM_LogicalDevice.

MACAddress

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Device Input and Output Functions|DeviceIoControl")

Media access control address for this network adapter. A MAC address is a unique 48-bit number assigned to the network adapter by the manufacturer. It uniquely identifies this network adapter and is used for mapping TCP/IP network communications.

Manufacturer

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32Registry|Software\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards|Manufacturer")

Name of the network adapter's manufacturer.

Example: "3COM"

MaxNumberControlled

Data type: uint32

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|Bus Port|001.9|Maximum Number of Attachments")

Maximum number of directly addressable ports supported by this network adapter. A value of 0 (zero) should be used if the number is unknown.

MaxSpeed

Data type: uint64

Access type: Read-only

Qualifiers: Units ("bits per second")

Maximum speed, in bits per second, for the network adapter.

This property is inherited from CIM_NetworkAdapter.

This property has not been implemented yet. It returns a NULL value by default.

For more information about using uint64 values in scripts, see Scripting in WMI.

Name

Data type: string

Access type: Read-only

Qualifiers: DisplayName ("Name")

Label by which the object is known. When subclassed, the property can be overridden to be a key property.

This property is inherited from CIM_ManagedSystemElement.

NetConnectionID

Data type: string

Access type: Read/write

Name of the network connection as it appears in the Network Connections Control Panel program.

NetConnectionStatus

Data type: uint16

Access type: Read-only

State of the network adapter connection to the network.

Disconnected (0)

Connecting (1)

Connected (2)

Disconnecting (3)

Hardware Not Present (4)

Hardware Disabled (5)

Hardware Malfunction (6)

Media Disconnected (7)

Authenticating (8)

Authentication Succeeded (9)

Authentication Failed (10)

Invalid Address (11)

Credentials Required (12)

Other

13–65535

NetEnabled

Data type: boolean

Access type: Read-only

Indicates whether the adapter is enabled or not. If True, the adapter is enabled. You can enable or disable the NIC by using the Enable and Disable methods.

NetworkAddresses

Data type: string array

Access type: Read-only

Qualifiers: MaxLen (64), MappingStrings ("MIF.DMTF|Network Adapter 802 Port|001.3")

Array of network addresses for an adapter.

This property is inherited from CIM_NetworkAdapter.

This property has not been implemented yet. It returns a NULL value by default.

PermanentAddress

Data type: string

Access type: Read-only

Qualifiers: MaxLen (64), MappingStrings ("MIF.DMTF|Network Adapter 802 Port|001.2")

Network address hard-coded into an adapter. This hard-coded address may be changed by firmware upgrade or software configuration. If so, this field should be updated when the change is made. The property should be left blank if no hard-coded address exists for the network adapter.

This property is inherited from CIM_NetworkAdapter.

This property has not been implemented yet. It returns a NULL value by default.

PhysicalAdapter

Data type: boolean

Access type: Read-only

Indicates whether the adapter is a physical or a logical adapter. If True, the adapter is physical.

PNPDeviceID

Data type: string

Access type: Read-only

Qualifiers: Schema ("Win32")

Windows Plug and Play device identifier of the logical device.

This property is inherited from CIM_LogicalDevice.

Example: "*PNP030b"

PowerManagementCapabilities

Data type: uint16 array

Access type: Read-only

Array of the specific power-related capabilities of a logical device.

This property is inherited from CIM_LogicalDevice.

Unknown (0)

Not Supported (1)

Disabled (2)

Enabled (3)

The power management features are currently enabled but the exact feature set is unknown or the information is unavailable.

Power Saving Modes Entered Automatically (4)

The device can change its power state based on usage or other criteria.

Power State Settable (5)

The SetPowerState method is supported. This method is found on the parent CIM_LogicalDevice class and can be implemented. For more information, see Designing Managed Object Format (MOF) Classes.

Power Cycling Supported (6)

The SetPowerState method can be invoked with the PowerState parameter set to 5 (Power Cycle).

Timed Power On Supported (7)

Timed Power-On Supported

The SetPowerState method can be invoked with the PowerState parameter set to 5 (Power Cycle) and Time set to a specific date and time, or interval, for power-on.

PowerManagementSupported

Data type: boolean

Access type: Read-only

If True, the device can be power-managed (can be put into suspend mode, and so on). The property does not indicate that power management features are currently enabled, only that the logical device is capable of power management.

This property is inherited from CIM_LogicalDevice.

ProductName

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32Registry|Software\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards|ServiceName")

Product name of the network adapter.

Example: "Fast EtherLink XL"

ServiceName

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32Registry|Software\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards|ProductName")

Service name of the network adapter. This name is usually shorter than the full product name.

Example: "Elnkii"

Speed

Data type: uint64

Access type: Read-only

Qualifiers: MappingStrings ("MIB.IETF|RFC1213-MIB.ifSpeed", "MIF.DMTF|Network Adapter 802 Port|001.5"), Units ("bits per second")

Estimate of the current bandwidth in bits per second. For endpoints which vary in bandwidth or for those where no accurate estimation can be made, this property should contain the nominal bandwidth.

This property is inherited from CIM_NetworkAdapter.

For more information about using uint64 values in scripts, see Scripting in WMI.

Status

Data type: string

Access type: Read-only

Qualifiers: MaxLen (10), DisplayName ("Status")

Current status of the object. This property is inherited from CIM_ManagedSystemElement.

Values include the following:

OK ("OK")

Error ("Error")

Degraded ("Degraded")

Unknown ("Unknown")

Pred Fail ("Pred Fail")

Starting ("Starting")

Stopping ("Stopping")

Service ("Service")

Stressed ("Stressed")

NonRecover ("NonRecover")

No Contact ("No Contact")

Lost Comm ("Lost Comm")

StatusInfo

Data type: uint16

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|Operational State|003.3")

State of the logical device. If this property does not apply to the logical device, the value 5 (Not Applicable) should be used.

This property is inherited from CIM_LogicalDevice.

Other (1)

Unknown (2)

Enabled (3)

Disabled (4)

Not Applicable (5)

SystemCreationClassName

Data type: string

Access type: Read-only

Qualifiers: Propagated ("CIM_System.CreationClassName"), CIM_Key

Value of the scoping computer's CreationClassName property.

This property is inherited from CIM_LogicalDevice.

SystemName

Data type: string

Access type: Read-only

Qualifiers: Propagated ("CIM_System.Name"), CIM_Key

Name of the scoping system.

This property is inherited from CIM_LogicalDevice.

TimeOfLastReset

Data type: datetime

Access type: Read-only

Qualifiers: MappingStrings ("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009|System Up Time")

Date and time the network adapter was last reset.

Remarks

The Win32_NetworkAdapter class is derived from CIM_NetworkAdapter.

The following list describes the Associator classes for Win32_NetworkAdapter:

Many systems have a number of network adapters on them. Consider using the following as a reference to find the current adapters:

AdapterType: "Ethernet 802.3"
MACAddress: String Length > 16
Availability: 3
PNPDeviceID: InStr ( PNPDeviceID, "PCI") = 1
Installed: vbTrue
ConfigManagerErrorCode: 0
: <keep this as an index to Win32_NetworkAdapterConfiguration>

Even using the above qualifiers, you will likely retrieve more than one valid network adapter. If that is the case, Then you can use the following information to further qualify your search of the Win32_NetworkAdapterConfiguration:

Index: <match to DeviceID above>
MACAddress: Length > 16
DefaultIPGateway: String Length > 6
DNSServerSearchOrder: Array of strings with length > 6
IPEnabled: vbTrue
IPAddress: Array of strings with length > 6

Once you have done so, you will likely have reduced your list to one or two configured adapters.

You can also use the following procedure to find the default adapter:

  1. Run the following query:

    "SELECT InterfaceIndex, Destination FROM Win32_IP4RouteTable WHERE Destination='0.0.0.0'"

    You should only have one default network destination 0.0.0.0.

  2. Use the InterfaceIndex to retrieve the Network Adapter you want.

    "SELECT * FROM Win32_NetworkAdapter WHERE InterfaceIndex=" + insertVariableHere

Examples

The Two WMI Functions (TwoWmiFunctions.ps1) PowerShell code example in the TechNet Gallery uses Win32_NetworkAdapter to re-create the Windows Get-NetAdapter cmdlet.

The following C# code sample uses Microsoft.Management.Infrastructure namespace to retrieve the current network adapters on the local machine.

using Microsoft.Management.Infrastructure;
...
static void QueryInstanceFunc()
        {
 
            CimSession session = CimSession.Create("localHost");
            IEnumerable<CimInstance> queryInstance = session.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_NetworkAdapter");

            foreach (CimInstance cimObj in queryInstance)
            {
                Console.WriteLine(cimObj.CimInstanceProperties["Name"].ToString());
                Console.WriteLine(cimObj.CimInstanceProperties["Description"].ToString());
                Console.WriteLine();
            }

            Console.ReadLine();
        }

The following C# code sample uses https://msdn.microsoft.com/library/system.management.aspx namespace to retrieve the current network adapters on the local machine.

Note

https://msdn.microsoft.com/library/system.management.aspx contains the original classes used to access WMI; however, they are considered slower and generally do not scale as well as their Microsoft.Management.Infrastructure counterparts.

 

using System.Management;
...
        static void oldSchoolQueryInstanceFunc()
        {

            ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_NetworkAdapter");
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);


            ManagementObjectCollection queryCollection = searcher.Get();
            foreach (ManagementObject m in queryCollection)
            {
                Console.WriteLine("ServiceName : {0}", m["Name"]);
                Console.WriteLine("MACAddress : {0}", m["Description"]);
                Console.WriteLine();
            }
            Console.ReadLine();

        }

The following VBScript code sample describes how to retrieve the current network adapters on the local machine.

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter")

For Each objItem in colItems 
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo
Next

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMV2
MOF
CIMWin32.mof
DLL
CIMWin32.dll

See also

CIM_NetworkAdapter

Computer System Hardware Classes

WMI Tasks: Networking

IPv6 and IPv4 Support in WMI