IVMNetworkAdapter interface

[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]

Serves as the interface to a virtual network interface card (NIC). It is used to set up how a virtual machine is networked. Network interface cards can be added and removed by using IVMVirtualMachine::AddNetworkAdapter and IVMVirtualMachine::RemoveNetworkAdapter. You can also retrieve an IVMNetworkAdapter object from the IVMNetworkAdapterCollection collection returned from the IVMVirtualMachine::NetworkAdapters or IVMVirtualNetwork::NetworkAdapters properties.

Members

The IVMNetworkAdapter interface inherits from the IDispatch interface. IVMNetworkAdapter also has these types of members:

Methods

The IVMNetworkAdapter interface has these methods.

Method Description
_ID Retrieves the internal identifier of this network interface.
AttachToVirtualNetwork Attaches the network interface to the specified virtual network.
DetachFromVirtualNetwork Detaches the network interface from its virtual network.

Properties

The IVMNetworkAdapter interface has these properties.

Property Access type Description
EthernetAddress
Read/write
The Ethernet (MAC) address of the network interface.
IsEthernetAddressDynamic
Read/write
Indicates whether the Ethernet address is dynamically generated.
VirtualMachine
Read-only
The virtual machine associated with this network interface.
VirtualNetwork
Read-only
The virtual network to which the network interface is attached.

Remarks

The default Ethernet address for a network interface is "00-00-00-00-00-00", which is considered an invalid Ethernet address by most operating systems. If IsEthernetAddressDynamic is set to FALSE, EthernetAddress must be initialized with a valid Ethernet network address.

The following procedures explain how to use the IVMNetworkAdapter interface.

To attach a virtual NIC to a host NIC

  • Virtual (guest) NICs are not attached directly to a host NIC. Instead, the virtual NIC is attached to a virtual network that is attached to a host NIC. For more information about configuring virtual networks, see IVMVirtualNetwork. To attach the virtual NIC to a virtual network, use the AttachToVirtualNetwork method.

To disconnect a virtual NIC from the virtual network

  • The DetachFromVirtualNetwork method will detach the virtual NIC from the virtual network. After this function is called, the VirtualNetwork property will return a virtual network ID that is not valid.

To remove a virtual NIC from a virtual machine if you have the virtual NIC object

  1. Get the virtual machine associated with the virtual NIC by using the VirtualMachine property.
  2. Use the current object as a parameter to the IVMVirtualMachine::RemoveNetworkAdapter method.

Requirements

Requirement Value
Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
None supported
End of client support
Windows 7
Product
Windows Virtual PC
Header
VPCCOMInterfaces.h
IID
IID_IVMNetworkAdapter is defined as e32e4165-22b8-4dc0-8d57-850171ae207a