New-VMHostNetworkAdapter Command | Vmware PowerCLI Reference

New-VMHostNetworkAdapter

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.

Syntax

New-VMHostNetworkAdapter
[ -VirtualSwitch ] < VirtualSwitchBase >
-NetworkStack < HostNetworkStack >
[ [-PortGroup ] < String > ]
[ [-IP ] < String > ]
[ [-SubnetMask ] < String > ]
[ [-Mac ] < String > ]
[-AutomaticIPv6 ]
[-IPv6 < String[] > ]
[-IPv6ThroughDhcp ]
[-Mtu < Int32 > ]
[-PortId < String > ]
[-Server < VIServer[] > ]
[-VMHost < VMHost > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VirtualSwitch VirtualSwitchBase 2
  • wildcards
Specifies the virtual switch to which you want to add the new network adapter.
required
NetworkStack HostNetworkStack named
Specifies the host network stack to which you want to add the new adapter.
optional PortGroup String 1
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.
optional IP String 3
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.
optional SubnetMask String 4
Specifies a subnet mask for the new network adapter.
optional Mac String 5
Specifies a media access control (MAC) address for the new virtual network adapter.
optional AutomaticIPv6 SwitchParameter named
Indicates that the IPv6 address is obtained through a router advertisement.
optional IPv6 String[] named
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.
optional IPv6ThroughDhcp SwitchParameter named
Indicates that the IPv6 address is obtained through DHCP.
optional Mtu Int32 named
Specifies the MTU size. This parameter is supported only on ESX/vCenter Server 4.1 and later.
optional 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 a distributed switch is passed to the VirtualSwitch parameter.
optional Server VIServer[] named
  • wildcards
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.
optional VMHost VMHost named
  • pipeline
  • wildcards
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.
New-VMHostNetworkAdapter
[ -VirtualSwitch ] < VirtualSwitchBase >
[ [-PortGroup ] < String > ]
[ [-IP ] < String > ]
[ [-SubnetMask ] < String > ]
[ [-Mac ] < String > ]
[-AutomaticIPv6 ]
[-ConsoleNic ]
[-FaultToleranceLoggingEnabled < Boolean > ]
[-IPv6 < String[] > ]
[-IPv6ThroughDhcp ]
[-ManagementTrafficEnabled < Boolean > ]
[-Mtu < Int32 > ]
[-PortId < String > ]
[-Server < VIServer[] > ]
[-VMHost < VMHost > ]
[-VMotionEnabled < Boolean > ]
[-VsanTrafficEnabled < Boolean > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VirtualSwitch VirtualSwitchBase 2
  • wildcards
Specifies the virtual switch to which you want to add the new network adapter.
optional PortGroup String 1
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.
optional IP String 3
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.
optional SubnetMask String 4
Specifies a subnet mask for the new network adapter.
optional Mac String 5
Specifies a media access control (MAC) address for the new virtual network adapter.
optional AutomaticIPv6 SwitchParameter named
Indicates that the IPv6 address is obtained through a router advertisement.
optional ConsoleNic SwitchParameter named
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.
optional FaultToleranceLoggingEnabled Boolean named
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.
optional IPv6 String[] named
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.
optional IPv6ThroughDhcp SwitchParameter named
Indicates that the IPv6 address is obtained through DHCP.
optional ManagementTrafficEnabled Boolean named
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.
optional Mtu Int32 named
Specifies the MTU size. This parameter is supported only on ESX/vCenter Server 4.1 and later.
optional 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 a distributed switch is passed to the VirtualSwitch parameter.
optional Server VIServer[] named
  • wildcards
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.
optional VMHost VMHost named
  • pipeline
  • wildcards
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.
optional VMotionEnabled Boolean named
Indicates that you want to use the new virtual host/VMKernel network adapter for VMotion.
optional VsanTrafficEnabled Boolean named
Indicates that Virtual SAN traffic is enabled on this network adapter.

Output

VMware.VimAutomation.ViCore.Types.V1.Host.Networking.Nic.HostVirtualNic

Examples

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 Commands

VMHost

This cmdlet adds a host to be managed by a vCenter Server system.

This cmdlet retrieves the hosts on a vCenter Server system.

This cmdlet moves hosts to another location.

This cmdlet removes the specified hosts from the inventory.

This cmdlet restarts the specified hosts.

This cmdlet modifies the configuration of the host.

This cmdlet starts the specified hosts.

This cmdlet powers off the specified hosts.

This cmdlet suspends hosts.

VMHostAccount

This cmdlet retrieves the host accounts available on a vCenter Server system.

This cmdlet creates a new host user or group account.

This cmdlet removes the specified host accounts.

This cmdlet configures a host account.

VMHostAdvancedConfiguration

This cmdlet retrieves the advanced configuration of the hosts.

This cmdlet modifies the advanced configuration settings of a host.

VMHostAuthentication

This cmdlet retrieves authentication information for the specified hosts.

This cmdlet modifies the host authentication information.

VMHostAvailableTimeZone

This cmdlet retrieves the time zones available on the specified host.

VMHostDiagnosticPartition

This cmdlet retrieves a list of the diagnostic partitions on the specified hosts.

This cmdlet activates or deactivates the diagnostic partitions of hosts.

VMHostDisk

This cmdlet retrieves information about the specified SCSI LUN disk.

VMHostDiskPartition

This cmdlet formats a new VMFS (Virtual Machine File System) on each of the specified host disk partitions.

This cmdlet retrieves the partitions of a host disk (LUN).

VMHostFirewallDefaultPolicy

This cmdlet retrieves the firewall default policy of the specified hosts.

This cmdlet sets the default policy for the specified host firewall.

VMHostFirewallException

This cmdlet retrieves the exceptions from the firewall policy on the specified hosts.

This cmdlet activates or deactivates host firewall exceptions.

VMHostFirmware

This cmdlet retrieves hosts firmware information.

This cmdlet configures hosts firmware settings.

VMHostHardware

This cmdlet retrieves ESXi host hardware and firmware information.

VMHostHba

This cmdlet retrieves information about the available HBAs (Host Bus Adapter).

This cmdlet configures the CHAP properties of the specified iSCSI HBAs.

VMHostImageDb

This cmdlet exports the specified host's base image database to a file that is in a .tgz format.

VMHostModule

This cmdlet retrieves the option strings of the specified host modules.

This cmdlet overrides the host module options with the given ones.

VMHostNetwork

THis cmdlet retrieves the host networks on a vCenter Server system.

This cmdlet updates the specified virtual network.

VMHostNetworkAdapter

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

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

This cmdlet removes the specified host network adapters.

This cmdlet configures the specified host network adapter.

VMHostNetworkStack

This cmdlet retrieves the host network stacks on a vCenter Server system.

This cmdlet modifies the specified host network stack.

VMHostNtpServer

This cmdlet adds the specified NTP servers to the NTP server list of the specified hosts.

This cmdlet retrieves the NTP servers on the specified hosts.

This cmdlet removes the specified NTP servers from the NTP server list of the specified hosts.

VMHostPatch

This cmdlet retrieves information about the host patches installed on the specified hosts. This cmdlet is deprecated and will not return any results for ESX hosts version 5.0 and later. Use (Get-ESXCli).software.vib.list() as an alternative.

This cmdlet updates the specified hosts.

VMHostPciDevice

This cmdlet retrieves the PCI devices on the specified hosts.

VMHostProfile

This cmdlet exports the specified host profile to a file.

This cmdlet retrieves the available host profiles.

This cmdlet imports a host profile from a file. The file path must be accessible from the VMware PowerCLI client side.

This cmdlet applies a host profile to the specified host or cluster.

This cmdlet creates a new host profile based on a reference host.

This cmdlet removes the specified host profiles.

This cmdlet modifies the specified host profile.

VMHostProfileCompliance

This cmdlet tests hosts for profile compliance.

VMHostProfileImageCacheConfiguration

Retrieves an image cache configuration for the given host profile.

This cmdlet modifies image cache configuration for given host profile.

VMHostProfileRequiredInput

This cmdlet performs a check whether the available information is sufficient to apply a host profile.

VMHostProfileStorageDeviceConfiguration

Retrieves the storage device configuration for the given host profile.

This cmdlet modifies the storage device configuration for the given host profile.

VMHostProfileUserConfiguration

This cmdlet retrieves the user password configuration for the given host profile.

This cmdlet modifies the user password configuration for the specified account within a host profile.

VMHostProfileVmPortGroupConfiguration

Retrieves the virtual machine port group configuration for the given host profile.

This cmdlet creates a new virtual machine port group configuration.

Removes the given virtual machine port group configuration from the host profile.

This cmdlet modifies the virtual machine port group configuration for the given host profile.

VMHostRoute

This cmdlet retrieves the routes from the routing table of the specified hosts.

This cmdlet creates a new route in the routing table of a host.

This cmdlet removes host routes.

This cmdlet modifies a route in the host routing table.

VMHostService

This cmdlet retrieves information about a host service.

This cmdlet restarts the specified host services.

This cmdlet modifies a host service.

This cmdlet starts the specified host services.

This cmdlet stops the specified host services.

VMHostSnmp

This cmdlet retrieves hosts SNMP configuration.

This cmdlet modifies the host SNMP configuration.

This cmdlet tests the host SNMP.

VMHostStartPolicy

This cmdlet retrieves the start policy of hosts.

This cmdlet modifies the host default start policy.

VMHostStorage

This cmdlet retrieves the host storages on a vCenter Server system.

This cmdlet configures a host storage.

VMHostSysLogServer

This cmdlet displays the remote syslog servers of the specified hosts.

This cmdlet configures the remote syslog server of the specified hosts.

VMHostTPM

This cmdlet retrieves the TPM 2.0 devices from the specified host.