Condividi tramite


Add-SCVMHostNetworkAdapter

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 on a host managed by 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.

System Center 2012 - VMM 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.

Parameters

-JobGroup<Guid]>

Specifies an identifier for a series of commands that runs 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 Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit 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

Indicates whether the cmdlet enables a VLAN for use by virtual machines on a Hyper-V or Citrix XenServer host.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VLanID<UInt16]>

Specifies a numeric identifier in the range 1-4094 for a virtual network adapter on a virtual machine or for 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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VLanMode<VlanMode]>

Specifies whether a 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[]>

Specifies an array of numeric identifiers in the range 1-4094 for physical network adapters on a Hyper-V host.

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.

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 (https://go.microsoft.com/fwlink/p/?LinkID=113216).

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

Example 1: Add a physical host network adapter to a virtual network

The first command gets the host object named VMHost01, and then stores the object in the $VMHost variable.

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

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

The last command adds HostAdapter01 to ExternalVirtualNetwork01.

You can add only one physical host adapter per virtual network. Therefore, if an adapter is already associated with the specified virtual network, the final command fails. 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

Example 2: Add a physical host network adapter to a VLAN that uses Trunk mode

The first command gets the host object named VMHost02, and then stores the object in the $VMHost variable.

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

The third command gets the network adapter object named HostAdapter02 on VMHost02, and then 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 by using 802.1Q tagged VLANs 1, 2, 100, 200, and 1124.

You can add only one host adapter per virtual network. Therefore, the last command fails 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

Example 3: Add a physical host network adapter to a VLAN that uses Access mode

The first command gets the host object named VMHost03, and then stores the object in the $VMHost variable.

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

The third command gets the network adapter object named HostAdapter03 on VMHost03, and then 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.

You can add only one host adapter per virtual network. Therefore, the last command fails if an adapter is already associated with the specified virtual network.

This example assumes that your host is already connected to a VLAN or, if not, 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 prevents 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

Get-SCVMHostNetworkAdapter

New-SCVirtualNetwork

New-SCVirtualNetworkAdapter

Remove-SCVMHostNetworkAdapter

Set-SCVirtualNetworkAdapter

Set-SCVMHostNetworkAdapter

Get-SCVMHost

Get-SCVirtualNetwork