Add-SCVMHostNetworkAdapter
Applies To: System Center 2012 - Virtual Machine Manager
Add-SCVMHostNetworkAdapter
Adds a physical network adapter on a host managed by VMM to a virtual network.
Syntax
Parameter Set: Default
Add-SCVMHostNetworkAdapter [-VMHostNetworkAdapter] <HostNetworkAdapter> -VirtualNetwork <VirtualNetwork> [-JobGroup <Guid> ] [-JobVariable <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [-VLanEnabled] [-VLanID <UInt16> ] [-VLanMode <VlanMode> ] [-VLanTrunkID <UInt16[]> ] [ <CommonParameters>]
Detailed 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
-JobGroup<Guid>
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-JobVariable<String>
Specifies that job progress is tracked and stored in the variable named by this parameter.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PROTipID<Guid>
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-RunAsynchronously
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VirtualNetwork<VirtualNetwork>
Specifies a virtual network object.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-VLanEnabled
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
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VLanID<UInt16>
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
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VLanMode<VlanMode>
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VLanTrunkID<UInt16[]>
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
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VMHostNetworkAdapter<HostNetworkAdapter>
Specifies a physical network adapter object on a host to which virtual machines deployed on that host can connect.
Example format: -VMHostNetworkAdapter $VMHostNIC
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- VMHostNetworkAdapter
Examples
1: Add a physical host network adapter to a virtual network.
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.
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
2: Add a physical host network adapter to a VLAN that uses "Trunk" mode.
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.
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
3: Add a physical host network adapter to a VLAN that uses "Access" mode.
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.
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