PowerCLI Reference

New-NetworkAdapter

Synopsis

This cmdlet creates a new virtual network adapter.

Syntax

New-NetworkAdapter [-VM] <VirtualMachine> [-DeviceProtocol <VrdmaDeviceProtocol>] -DistributedSwitch <DistributedSwitch> [-MacAddress <String>] [-PhysicalFunction <String>] -PortId <String> [-Server <VIServer[]>] [-StartConnected] [-Type <VirtualNetworkAdapterType>] [-WakeOnLan] [-Confirm] [-WhatIf] [<CommonParameters>]

New-NetworkAdapter [-VM] <VirtualMachine> [-DeviceProtocol <VrdmaDeviceProtocol>] [-MacAddress <String>] -NetworkName <String> [-PhysicalFunction <String>] [-Server <VIServer[]>] [-StartConnected] [-Type <VirtualNetworkAdapterType>] [-WakeOnLan] [-Confirm] [-WhatIf] [<CommonParameters>]

New-NetworkAdapter [-VM] <VirtualMachine> [-DeviceProtocol <VrdmaDeviceProtocol>] [-MacAddress <String>] [-PhysicalFunction <String>] -Portgroup <VirtualPortGroupBase> [-Server <VIServer[]>] [-StartConnected] [-Type <VirtualNetworkAdapterType>] [-WakeOnLan] [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version
Get-NetworkAdapter
Remove-NetworkAdapter
Set-NetworkAdapter

Detailed Description

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

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
VMVirtualMachineSpecifies the virtual machine to which you want to attach the new virtual network adapter. Passing multiple values to this parameter is obsolete.trueTrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falseFalse
DeviceProtocolVrdmaDeviceProtocolSpecifies the device protocol for a Vmxnet3Vrdma adapter. If omitted, the server applies a default value.falseFalse
DistributedSwitchDistributedSwitchSpecifies a virtual switch to which you want to connect the network adapter.trueFalse
MacAddressStringSpecifies an optional MAC address for the new virtual network adapter.falseFalse
NetworkNameStringSpecifies 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.trueFalse
PhysicalFunctionStringSpecifies the PCI ID of the physical device, backing a SriovEthernetCard adapter. If omitted, automatic mode is used for the physical function.falseFalse
PortgroupVirtualPortGroupBaseSpecifies a standard or a distributed port group to which you want to connect the new network adapter.trueFalse
PortIdStringSpecifies 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.trueFalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no 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.falseFalse
StartConnectedSwitchParameterIndicates that the virtual network adapter starts connected when the virtual machine associated with it powers on.falseFalse
TypeVirtualNetworkAdapterTypeSpecifies 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.falseFalse
WakeOnLanSwitchParameterIndicates that wake-on-LAN is enabled on the newly created virtual network adapter.falseFalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse

Return Type

The one or more newly created NetworkAdapter objects

Notes

There are two special cases concerning the behavior of New-NetworkAdapter: - If you are directly connected to a standalone ESX host (that is not managed by a vCenter Server), the MAC address of the newly created network adapter is generated after the associated virtual machine is powered on for a first time. - If you are directly connected to an ESX host that is managed by a vCenter Server, the MAC address of the newly created network adapter is generated with a delay of several seconds.

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.


Copyright © VMware, Inc. All rights reserved.