Add-VirtualSwitchPhysicalNetworkAdapter Command | Vmware PowerCLI Reference

Add-VirtualSwitchPhysicalNetworkAdapter

This cmdlet adds a host physical NIC to a standard virtual switch. If VMHost virtual network adapters are specified, the cmdlet migrates them to the virtual switch as well.Note: If VMHost virtual network adapters are specified, the cmdlet migrates them to the respective port groups or creates new ones if VirtualNicPortgroup is not specified.

Syntax

Add-VirtualSwitchPhysicalNetworkAdapter
[ -VirtualSwitch ] < VirtualSwitch >
-VMHostPhysicalNic < PhysicalNic[] >
[-ProgressAction < ActionPreference > ]
[-Server < VIServer[] > ]
[-VMHostVirtualNic < HostVirtualNic[] > ]
[-VirtualNicPortgroup < VirtualPortGroup[] > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VirtualSwitch VirtualSwitch 1
  • pipeline
Specifies the standard virtual switch to which you want to migrate physical or virtual network adapters.
required
VMHostPhysicalNic PhysicalNic[] named
Specifies the host physical network adapters that you want to add or migrate to the standard virtual switch.
optional ProgressAction ActionPreference named
optional Server VIServer[] named
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.
optional VMHostVirtualNic HostVirtualNic[] named
Specifies the host virtual network adapters to be migrated along with the physical adapter, so that their connectivity is preserved.
optional VirtualNicPortgroup VirtualPortGroup[] named
Specifies the port groups to which to attach the host virtual network adapters. Accepts the same number of port groups as the number of virtual network adapters specified. The first adapter is attached to the first port group, the second adapter - to the second port group, and so on.

Output

Examples

Example 1

$myVMHostNetworkAdapter = Get-VMhost "MyVMHost" | Get-VMHostNetworkAdapter -Physical -Name vmnic2
Get-VirtualSwitch "MyVirtualSwitch" | Add-VirtualSwitchPhysicalNetworkAdapter -VMHostPhysicalNic $myVMHostNetworkAdapter

Adds a VMHost physical network adapter to the specified distributed switch.

Example 2

$myVMHost = Get-VMHost 'MyVMHost'
$myVDSwitch = Get-VDSwitch 'MyVDSwitch'
$physicalNic = Get-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -Name 'vmnic0'
$virtualNic = Get-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -Name 'vmk0'
$myStandardSwitch = Get-VirtualSwitch -VMHost $myVMHost -Name 'vSwitch0'
Add-VirtualSwitchPhysicalNetworkAdapter -VirtualSwitch $myStandardSwitch -VMHostPhysicalNic $physicalNic -VMHostVirtualNic $virtualNic

Migrates VMHost physical and virtual network adapters from a distributed virtual switch to a standard virtual switch.

Related Commands

VirtualSwitch

This cmdlet retrieves the virtual switches associated with a virtual machine host or used by a virtual machine.

This cmdlet creates a new virtual switch.

This cmdlet removes the specified virtual switches from their locations.

This cmdlet modifies the properties of the specified virtual switch.

VirtualSwitchPhysicalNetworkAdapter

This cmdlet adds a host physical NIC to a standard virtual switch.

This cmdlet removes the specified host physical NICs from the standard virtual switch.