Add-SCVMHostNetworkAdapter

Adds a physical network adapter on a host managed by VMM to a virtual network.

Description

The Add-SCVMHostNetworkAdapter cmdlet adds a physical network adapter (also called a network interface card, or NIC) on a host managed by System Center Virtual Machine Manager (VMM) to a virtual network. Each virtual machine on that host can also connect through a virtual network adapter to that virtual network. 

A virtual network configured on a host can connect to multiple virtual network adapters on virtual machines deployed on that host. 

VMM for System Center 2012 includes virtual networking support for configuring one or more Virtual Local Area Networks (VLANs) on a host. You can use the Add-SCVMHostNetworkAdapter cmdlet or the Set-SCVMHostNetworkAdapter cmdlet to configure a single VLAN or multiple VLANs on a host. To configure corresponding VLAN settings on a virtual machine, use the New-SCVirtualNetworkAdapter cmdlet or the Set-SCVirtualNetworkAdapter cmdlet.

For an illustration of each type of VLAN, see the examples for this cmdlet. 

For more information about Add-SCVMHostNetworkAdapter, type: "Get-Help Add-SCVMHostNetworkAdapter -online".

Parameters

VMHostNetworkAdapter

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a physical network adapter object on a host to which virtual machines deployed on that host can connect.

Example format: -VMHostNetworkAdapter $VMHostNIC

VirtualNetwork

Required? true
Accept Pipeline Input? true (ByValue)
Position? named
Specifies a virtual network object.

JobGroup

Required? false
Accept Pipeline Input? false
Position? named
Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs. 

JobVariable

Required? false
Accept Pipeline Input? false
Position? named
Specifies that job progress is tracked and stored in the variable named by this parameter. 

PROTipID

Required? false
Accept Pipeline Input? false
Position? named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

RunAsynchronously

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the job runs asynchronously so that control returns to the command shell immediately. 

VLanEnabled

Required? false
Accept Pipeline Input? false
Position? named
Enables a virtual LAN (VLAN) for use by virtual machines on a Hyper-V or Citrix XenServer host. 

Example format for a single VLAN: -VLANEnabled -VLANMode "Access" -VLANID 35
Example format for multiple VLANs: -VLANEnabled -VLANMode "Trunk"  -VLANTrunkID 1,2,100,200,1124

VLanID

Required? false
Accept Pipeline Input? false
Position? named
Assigns a numerical identifier in the range 1-4094 to a virtual network adapter on a virtual machine or to a physical network adapter on a virtual machine host. 

Configure a VLanID on a Hyper-V, VMware ESX, or Citrix XenServer host:
 - On an externally bound physical network adapter when the VLan mode is Access.  

Configure a VLanID on a virtual network adapter of a virtual machine:
 - Bound to a physical network adapter on the host, or
 - Bound to an internal virtual network on the host.

Example format:  -VLanEnabled
 -VLanMode "Access" -VLANID 35

VLanMode

Required? false
Accept Pipeline Input? false
Position? named
Specifies whether a virtual LAN (VLAN) on a virtual machine host supports traffic across a single VLAN ("Access" mode) or across multiple VLANs ("Trunk" mode). Valid values are: Access, Trunk.

VLanTrunkID

Required? false
Accept Pipeline Input? false
Position? named
Assigns a list of numerical identifiers in the range 1-4094 to a physical network adapter on a Hyper-V host.

Example format: -VLANEnabled -VLANMode "Trunk" -VLANTrunkID 1,2,100,200,1124

Examples

1: Add a physical host network adapter to a virtual network.
PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01.Contoso.com"
PS C:\> $VirtualNetwork = Get-SCVirtualNetwork -VMHost $VMHost -Name "ExternalVirtualNetwork01"
PS C:\> $VMHostNetworkAdapter = Get-SCVMHostNetworkAdapter -VMHost $VMHost -Name "HostAdapter01"
PS C:\> Add-SCVMHostNetworkAdapter -VirtualNetwork $VirtualNetwork -VMHostNetworkAdapter $VMHostNetworkAdapter
The first command gets the host object named VMHost01 and stores the object in the $VMHost variable.

The second command gets the virtual network object named ExternalVirtualNetwork01 on VMHost01 and stores the object in the $VirtualNetwork variable. 

The third command gets the physical network adapter object named HostAdapter01 on VMHost01 and stores the object in the $VMHostNetworkAdapter variable. 

The last command adds HostAdapter01 to ExternalVirtualNetwork01. 

NOTE: You can add only one physical host adapter per virtual network. Therefore, the last command will fail if an adapter is already associated with the specified virtual network. To add a new adapter to the virtual network, you must first remove the existing host adapter.
2: Add a physical host network adapter to a VLAN that uses "Trunk" mode.
PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost02"
PS C:\> $VirtualNetwork = Get-SCVirtualNetwork -VMHost $VMHost -Name "ExternalNetwork02"
PS C:\> $VMHostNetworkAdapter = Get-SCVMHostNetworkAdapter -VMHost $VMHost -Name "HostAdapter02"
PS C:\> Add-SCVMHostNetworkAdapter -VirtualNetwork $VirtualNetwork -VMHostNetworkAdapter $VMHostNetworkAdapter –VLANEnabled –VLANMode "Trunk" –VLANTrunkID 1,2,100,200,1124
The first command gets the host object named VMHost02 and stores the object in the $VMHost variable.

The second command gets the virtual network object named ExternalNetwork02 on VMHost02 and stores the object in the $VirtualNetwork variable.

The third command gets the network adapter object named HostAdapter02 on VMHost02 and stores the adapter object in the $VMHostNetworkAdapter variable. 

The last command adds HostAdapter02 to virtual network ExternalNetwork02 and enables access from ExternalNetwork02 to an external networking device using 802.1Q tagged VLANs 1, 2, 100, 200, and 1124.

NOTE: You can add only one host adapter per virtual network, so the last command will fail if an adapter is already associated with the specified virtual network.
3: Add a physical host network adapter to a VLAN that uses "Access" mode.
PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost03.Contoso.com"
PS C:\> $VirtualNetwork = Get-SCVirtualNetwork -VMHost $VMHost -Name "ExternalVirtualNetwork03"
PS C:\> $VMHostNetworkAdapter = Get-SCVMHostNetworkAdapter -VMHost $VMHost -Name "HostAdapter03"
PS C:\> Add-SCVMHostNetworkAdapter -VirtualNetwork $VirtualNetwork -VMHostNetworkAdapter $VMHostNetworkAdapter –VLanEnabled –VLanMode "Access" –VLanID 22
The first command gets the host object named VMHost03 and stores the object in the $VMHost variable.

The second command gets the virtual network object named ExternalNetwork03 on VMHost03 and stores the object in the $VirtualNetwork variable.

The third command gets the network adapter object named HostAdapter03 on VMHost03 and stores the adapter object in the$VMHostNetworkAdapter variable. 

The last command adds HostAdapter03 to virtual network ExternalNetwork03 and restricts access to ExternalNetwork03 to VLANID 22.

NOTE: You can add only one host adapter per virtual network, so the last command will fail if an adapter is already associated with the specified virtual network. 

CAUTION: This example assumes that that your host is already connected to a VLAN or, if not, ensure that your host has two network adapters. If your host has a single network adapter, assigning the adapter to a VLAN that is unavailable to the VMM server will prevent VMM from managing the host. You can perform the steps in this example on a host that has only one network adapter if you first install the Microsoft Loopback Adapter on your server.

See Also