< Back

New-VMHostNetworkAdapter

Sun Jan 19, 2020 7:02 pm

NAME New-VMHostNetworkAdapter



SYNOPSIS

This cmdlet creates a new HostVirtualNIC (Service Console or VMKernel) on the specified host.





SYNTAX

New-VMHostNetworkAdapter [[-VMHost] <VMHost>] [[-PortGroup] <String>] [-VirtualSwitch] <VirtualSwitchBase> [[-IP]

<String>] [[-SubnetMask] <String>] [[-Mac] <String>] [-AutomaticIPv6] [-ConsoleNic] [-FaultToleranceLoggingEnabled

<Boolean>] [-IPv6 <String[]>] [-IPv6ThroughDhcp] [-ManagementTrafficEnabled <Boolean>] [-Mtu <Int32>] [-PortId

<String>] [-Server <VIServer[]>] [-VMotionEnabled <Boolean>] [-VsanTrafficEnabled <Boolean>] [-Confirm] [-WhatIf]

[<CommonParameters>]





DESCRIPTION

This cmdlet creates a new HostVirtualNIC (Service Console or VMKernel) on the specified host. Creates a port group

with a name specified by the PortGroup parameter on the virtual switch passed through the VirtualSwitch parameter.

Adds either a Console NIC if ConsoleNIC is set, or a VMKernel NIC otherwise.





PARAMETERS

-AutomaticIPv6 [<SwitchParameter>]

Indicates that the IPv6 address is obtained through a router advertisement.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-ConsoleNic [<SwitchParameter>]

If the value is $true, indicates that you want to create a service console virtual network adapter. If the

value is $false, indicates that you want to create a virtual host/VMkernel network adapter. Not supported on

ESXi.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-FaultToleranceLoggingEnabled <Boolean>

Indicates that the network adapter is enabled for Fault Tolerance (FT) logging. This parameter is supported

only on ESX/vCenter Server 4.1 and later.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IP <String>

Specifies an IP address for the new network adapter. All IP addresses are specified using IPv4 dot notation.

If IP is not specified, DHCP mode is enabled. For VMKernel network adapters, the DHCP mode is supported only

on vCenter Server 4.1, ESX 4.1, and later.



Required? false

Position? 4

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IPv6 <String[]>

Specifies multiple static addresses using the following format: <IPv6>/<subnet_prefix_length> or <IPv6>. If

you skip <subnet_prefix_length>, the default value of 64 is used.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IPv6ThroughDhcp [<SwitchParameter>]

Indicates that the IPv6 address is obtained through DHCP.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Mac <String>

Specifies a media access control (MAC) address for the new virtual network adapter.



Required? false

Position? 6

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ManagementTrafficEnabled <Boolean>

Indicates that you want to enable the network adapter for management traffic. This parameter is supported only

on ESX/ESXi/vCenter Server 4.1 and later.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Mtu <Int32>

Specifies the MTU size. This parameter is supported only on ESX/vCenter Server 4.1 and later.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-PortGroup <String>

Specifies the port group to which you want to add the new adapter. If a distributed switch is passed to the

VirtualSwitch parameter, an existing port group name should be specified. For standard virtual switches, if

the port group is non-existent, a new port group with the specified name will be created and the new adapter

will be added to the port group.



Required? false

Position? 2

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 a distributed switch is passed to the VirtualSwitch parameter.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Server <VIServer[]>

The Server parameter is required when the host is specified by name. In this case, the host with the specified

name is searched for on the specified Servers and a network adapter is added to it. If a VMHost object is

passed to the VMHost parameter, the Server parameter is not used.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-SubnetMask <String>

Specifies a subnet mask for the new network adapter.



Required? false

Position? 5

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-VirtualSwitch <VirtualSwitchBase>

Specifies the virtual switch to which you want to add the new network adapter.



Required? true

Position? 3

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-VMHost <VMHost>

Specifies the host to which you want to add the new adapter. This parameter is mandatory when creating a

network adapter on a distributed switch.



Required? false

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? true



-VMotionEnabled <Boolean>

Indicates that you want to use the new virtual host/VMKernel network adapter for VMotion.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-VsanTrafficEnabled <Boolean>

Indicates that Virtual SAN traffic is enabled on this network adapter.



Required? false

Position? named

Default value None

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 newly created HostVirtualNic object







NOTES





To configure IPv6 settings, you must be working on ESX 4.1 or later and IPv6 must be enabled on the ESX system.



-------------------------- Example 1 --------------------------



$vmhost = Get-VMHost -Name MyVMHost1

$myVirtualSwitch = Get-VirtualSwitch -VMHost $vmhost -Name MyVirtualSwitch1

New-VMHostNetworkAdapter -VMHost $vmhost -PortGroup MyVMKernelPortGroup1 -VirtualSwitch $myVirtualSwitch -Mtu 4000



Creates a VMKernel port group at the MyVirtualSwitch1 virtual switch. The IP address is obtained via DHCP.

-------------------------- Example 2 --------------------------



$vmhost = Get-VMHost -Name MyVMHost1

$myVirtualSwitch = Get-VirtualSwitch -VMHost $vmhost -Name MyVirtualSwitch1

New-VMHostNetworkAdapter -VMHost $vmhost -PortGroup MyVMKernelPortGroup1 -VirtualSwitch $myVirtualSwitch -IP

192.168.168.110 -SubnetMask 255.255.255.0



Creates a VMKernel port group at the MyVirtualSwitch1 virtual switch and assigns a static IP address.

-------------------------- Example 3 --------------------------



$vmhost = Get-VMHost -Name MyVMHost1

$myVirtualSwitch = Get-VirtualSwitch -VMHost $vmhost -Name MyVirtualSwitch1

New-VMHostNetworkAdapter -VMHost $vmhost -VirtualSwitch $myVirtualSwitch -PortGroup MyVMKernelPortGroup1 -IP

192.168.0.1 -SubnetMask 255.255.255.0 -IPv6 "0200:2342::1/32"



Creates a VMKernel NIC that has an IPv4 address and an IPv6 address.

-------------------------- Example 4 --------------------------



$vmhost = Get-VMHost -Name MyVMHost1

$myVirtualSwitch = Get-VirtualSwitch -VMHost $vmhost -Name MyVirtualSwitch1

New-VMHostNetworkAdapter -VMHost $vmhost -VirtualSwitch $myVirtualSwitch -PortGroup MyVMKernelPortGroup1 -IP

192.168.0.1 -SubnetMask 255.255.255.0 -AutomaticIPv6



Creates a VMKernel NIC that obtains IPv6 automatically (by router advertisement) and takes the desired IPv4

address.

-------------------------- Example 5 --------------------------



$vmhost = Get-VMHost -Name MyVMHost1

$myVirtualSwitch = Get-VirtualSwitch -VMHost $vmhost -Name MyVirtualSwitch1

New-VMHostNetworkAdapter -VMHost $vmhost -VirtualSwitch $myVirtualSwitch -PortGroup MyVMKernelPortGroup1

-IPv6ThroughDhcp



Creates a VMKernel NIC that obtains the IPv4 and IPv6 addresses by DHCP.

-------------------------- Example 6 --------------------------



$vmhost = Get-VMHost -Name MyVMHost1

$myVirtualSwitch = Get-VirtualSwitch -VMHost $vmhost -Name MyVirtualSwitch1

New-VMHostNetworkAdapter -VMHost $vmhost -PortGroup MyConsolePortGroup1 -VirtualSwitch $myVirtualSwitch -ConsoleNic



Creates a Service Console port group at the vSwitch virtual switch. The IP address is obtained via DHCP.

-------------------------- Example 7 --------------------------



$myVMHost = Get-VMHost -Name "MyVMHost"

$myVDSwitch = Get-VDSwitch -Name "MyVDSwitch"

New-VMHostNetworkAdapter -VMHost $myVMHost -PortGroup "MyVDPortgroup" -VirtualSwitch $myVDSwitch -IP 192.168.0.50

-SubnetMask 255.255.255.0



Creates a new VMKernel network adapter and connects it to the specified port group on the specified distributed

switch.

-------------------------- Example 8 --------------------------



$myVMHost = Get-VMHost -Name "MyVMHost"

$myVDSwitch = Get-VDSwitch -Name "MyVDSwitch"

New-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -PortId 100 -IP 192.168.0.50 -SubnetMask

255.255.255.0



Creates a new VMKernel network adapter and connects it to a specified port on a specified distributed switch.



RELATED LINKS

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

Remove-VMHostNetworkAdapter

Set-VMHostNetworkAdapter