New-NetworkAdapter Command | Vmware PowerCLI Reference

New-NetworkAdapter

This cmdlet creates a new virtual network adapter for each of the provided virtual machines and sets the optional properties if provided.

Syntax

New-NetworkAdapter
-DistributedSwitch < DistributedSwitch >
-PortId < String >
-VM < VirtualMachine >
[-DeviceProtocol < VrdmaDeviceProtocol > ]
[-MacAddress < String > ]
[-PhysicalFunction < String > ]
[-ProgressAction < ActionPreference > ]
[-Server < VIServer[] > ]
[-StartConnected ]
[-WakeOnLan ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
DistributedSwitch DistributedSwitch named
  • wildcards
Specifies a virtual switch to which you want to connect the network adapter.
required
PortId String named
Specifies the port of the specified distributed switch to which you want to connect the network adapter. Use this parameter only if the DistributedSwitch parameter is specified.
required
VM VirtualMachine named
  • pipeline
  • wildcards
Specifies the virtual machine to which you want to attach the new virtual network adapter. Passing multiple values to this parameter is obsolete.
optional DeviceProtocol VrdmaDeviceProtocol named
Specifies the device protocol for a Vmxnet3Vrdma adapter. If omitted, the server applies a default value.
optional MacAddress String named
Specifies an optional MAC address for the new virtual network adapter.
optional PhysicalFunction String named
Specifies the PCI ID of the physical device, backing a SriovEthernetCard adapter. If omitted, automatic mode is used for the physical function.
optional ProgressAction ActionPreference named
optional Server VIServer[] named
  • wildcards
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 StartConnected SwitchParameter named
Indicates that the virtual network adapter starts connected when the virtual machine associated with it powers on.
optional Type VirtualNetworkAdapterType named
Specifies the type of the new network adapter. The valid types are e1000, Flexible, Vmxnet, EnhancedVmxnet, Vmxnet3, SriovEthernetCard, Vmxnet3Vrdma, and Unknown. If no value is given to the parameter, the new network adapter is of the type recommended by VMware for the given guest OS.
optional WakeOnLan SwitchParameter named
Indicates that wake-on-LAN is enabled on the newly created virtual network adapter.
New-NetworkAdapter
-Portgroup < VirtualPortGroupBase >
-VM < VirtualMachine >
[-DeviceProtocol < VrdmaDeviceProtocol > ]
[-MacAddress < String > ]
[-PhysicalFunction < String > ]
[-ProgressAction < ActionPreference > ]
[-Server < VIServer[] > ]
[-StartConnected ]
[-WakeOnLan ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Portgroup VirtualPortGroupBase named
Specifies a standard or a distributed port group to which you want to connect the new network adapter.
required
VM VirtualMachine named
  • pipeline
  • wildcards
Specifies the virtual machine to which you want to attach the new virtual network adapter. Passing multiple values to this parameter is obsolete.
optional DeviceProtocol VrdmaDeviceProtocol named
Specifies the device protocol for a Vmxnet3Vrdma adapter. If omitted, the server applies a default value.
optional MacAddress String named
Specifies an optional MAC address for the new virtual network adapter.
optional PhysicalFunction String named
Specifies the PCI ID of the physical device, backing a SriovEthernetCard adapter. If omitted, automatic mode is used for the physical function.
optional ProgressAction ActionPreference named
optional Server VIServer[] named
  • wildcards
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 StartConnected SwitchParameter named
Indicates that the virtual network adapter starts connected when the virtual machine associated with it powers on.
optional Type VirtualNetworkAdapterType named
Specifies the type of the new network adapter. The valid types are e1000, Flexible, Vmxnet, EnhancedVmxnet, Vmxnet3, SriovEthernetCard, Vmxnet3Vrdma, and Unknown. If no value is given to the parameter, the new network adapter is of the type recommended by VMware for the given guest OS.
optional WakeOnLan SwitchParameter named
Indicates that wake-on-LAN is enabled on the newly created virtual network adapter.
New-NetworkAdapter
-NetworkName < String >
-VM < VirtualMachine >
[-DeviceProtocol < VrdmaDeviceProtocol > ]
[-MacAddress < String > ]
[-PhysicalFunction < String > ]
[-ProgressAction < ActionPreference > ]
[-Server < VIServer[] > ]
[-StartConnected ]
[-WakeOnLan ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
NetworkName String named
Specifies the name of the network to which you want to add the new virtual network adapter. Specifying a distributed port group name is obsolete. Use the Portgroup parameter instead.
required
VM VirtualMachine named
  • pipeline
  • wildcards
Specifies the virtual machine to which you want to attach the new virtual network adapter. Passing multiple values to this parameter is obsolete.
optional DeviceProtocol VrdmaDeviceProtocol named
Specifies the device protocol for a Vmxnet3Vrdma adapter. If omitted, the server applies a default value.
optional MacAddress String named
Specifies an optional MAC address for the new virtual network adapter.
optional PhysicalFunction String named
Specifies the PCI ID of the physical device, backing a SriovEthernetCard adapter. If omitted, automatic mode is used for the physical function.
optional ProgressAction ActionPreference named
optional Server VIServer[] named
  • wildcards
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 StartConnected SwitchParameter named
Indicates that the virtual network adapter starts connected when the virtual machine associated with it powers on.
optional Type VirtualNetworkAdapterType named
Specifies the type of the new network adapter. The valid types are e1000, Flexible, Vmxnet, EnhancedVmxnet, Vmxnet3, SriovEthernetCard, Vmxnet3Vrdma, and Unknown. If no value is given to the parameter, the new network adapter is of the type recommended by VMware for the given guest OS.
optional WakeOnLan SwitchParameter named
Indicates that wake-on-LAN is enabled on the newly created virtual network adapter.

Output

VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.NetworkAdapter

Examples

Example 1

Get-VM VM | New-NetworkAdapter  -NetworkName "VM Network" -MacAddress '00:50:56:a1:00:00' -WakeOnLan -StartConnected -Type EnhancedVmxnet

Create a virtual network adapter with the specified parameters.

Example 2

$myVm = Get-VM -Name MyVM
$MyVDPortgroup = Get-VDPortgroup -Name MyVDPortGroup
New-NetworkAdapter -VM $myVM -Portgroup $MyVDPortgroup

Adds a new network adapter to the specified virtual machine and connects it to the specified distributed port group.

Example 3

$myVM = Get-VM -Name MyVM
$MyVDSwitch = Get-VDSwitch -Name MyVDSwitch
New-NetworkAdapter -VM $myVM -DistributedSwitch $MyVDSwitch -PortId 100

Adds a new network adapter to the specified virtual machine and connects it to the specified port on the specified vSphere distributed switch.

Example 4

$myVM = Get-VM -Name MyVM
$myVDSwitch = Get-VDSwitch -Name MyVDSwitch
New-NetworkAdapter -VM $myVM -Type Vmxnet3Vrdma -DistributedSwitch $myVDSwitch -PortId 3

Adds a new PVRDMA network adapter to the specified virtual machine and connects it to the specified port on the specified vSphere distributed switch.

Example 5

$myVM = Get-VM -Name MyVM
$myPhysicalNetworkAdapter = Get-VMHost -Name vmhost1 | Get-VMHostNetworkAdapter -Physical -Name vmnic0
New-NetworkAdapter -VM $myVM -Type SriovEthernetCard -NetworkName 'VM Network' -PhysicalFunction $myPhysicalNetworkAdapter.PciId

Adds a new SR-IOV network adapter to the specified virtual machine and connects it to the specified network.

Related Commands

NetworkAdapter

This cmdlet retrieves the virtual network adapters available on a vCenter Server system.

This cmdlet creates a new virtual network adapter.

This cmdlet removes the virtual network adapters from their locations.

This cmdlet modifies the configuration of the virtual network adapter.