< Back

New-NetworkAdapter

Sun Jan 19, 2020 7:00 pm

NAME 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>]





DESCRIPTION

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

properties if provided.





PARAMETERS

-DeviceProtocol <VrdmaDeviceProtocol>

Specifies the device protocol for a Vmxnet3Vrdma adapter. If omitted, the server applies a default value.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DistributedSwitch <DistributedSwitch>

Specifies a virtual switch to which you want to connect the network adapter.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-MacAddress <String>

Specifies an optional MAC address for the new virtual network adapter.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? 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.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Portgroup <VirtualPortGroupBase>

Specifies a standard or a distributed port group to which you want to connect the new network adapter.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? 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.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-StartConnected [<SwitchParameter>]

Indicates that the virtual network adapter starts connected when the virtual machine associated with it powers

on.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-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.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? true



-WakeOnLan [<SwitchParameter>]

Indicates that wake-on-LAN is enabled on the newly created virtual network adapter.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-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.



Required? false

Position? named

Default value $true

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are

modified.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

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.



-------------------------- 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 LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... apter.html

Get-NetworkAdapter

Remove-NetworkAdapter

Set-NetworkAdapter