Syntax
New-NetworkAdapter [-VM] <VirtualMachine> [-DeviceProtocol <VrdmaDeviceProtocol>] -DistributedSwitch <DistributedSwitch> [-MacAddress <String>] [-PhysicalFunction <String>] -PortId <String> [-Server <VIServer[]>] [-StartConnected] [-Type <VirtualNetworkAdapterType>] [-WakeOnLan] [-Confirm] [-WhatIf] [<CommonParameters>]Related Commands
Online VersionDetailed Description
This cmdlet creates a new virtual network adapter for each of the provided virtual machines and sets the optional properties if provided.Parameters
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
VM | VirtualMachine | Specifies the virtual machine to which you want to attach the new virtual network adapter. Passing multiple values to this parameter is obsolete. | true | True (ByValue) | |
Confirm | SwitchParameter | If 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. | false | False | |
DeviceProtocol | VrdmaDeviceProtocol | Specifies the device protocol for a Vmxnet3Vrdma adapter. If omitted, the server applies a default value. | false | False | |
DistributedSwitch | DistributedSwitch | Specifies a virtual switch to which you want to connect the network adapter. | true | False | |
MacAddress | String | Specifies an optional MAC address for the new virtual network adapter. | false | False | |
NetworkName | String | 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. | true | False | |
PhysicalFunction | String | Specifies the PCI ID of the physical device, backing a SriovEthernetCard adapter. If omitted, automatic mode is used for the physical function. | false | False | |
Portgroup | VirtualPortGroupBase | Specifies a standard or a distributed port group to which you want to connect the new network adapter. | true | False | |
PortId | String | 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. | true | False | |
Server | VIServer[] | 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. | false | False | |
StartConnected | SwitchParameter | Indicates that the virtual network adapter starts connected when the virtual machine associated with it powers on. | false | False | |
Type | VirtualNetworkAdapterType | 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. | false | False | |
WakeOnLan | SwitchParameter | Indicates that wake-on-LAN is enabled on the newly created virtual network adapter. | false | False | |
WhatIf | SwitchParameter | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | False |
Return Type
The one or more newly created NetworkAdapter objectsNotes
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.