powershellscripts.com

Tutorials  PowerShell Cmdlet Help for New-VMHostNetworkAdapter



NAME
New-VMHostNetworkAdapter

SYNOPSIS
Creates a new HostVirtualNIC (Service Console or VMKernel) on the specified host.

SYNTAX
New-VMHostNetworkAdapter [-VMHost] [[-PortGroup] ] [-PortKey ] [-VirtualSwitch] itchBase> [[-IP] ] [[-SubnetMask] ] [[-Mac] ] [-Mtu ] [-ConsoleNic] [-VMotionEnabled
[]] [-FaultToleranceLoggingEnabled []] [-IPv6ThroughDhcp] [-AutomaticIPv6] [-IPv6 ] [-
ManagementTrafficEnabled []] [-Server ] [-WhatIf] [-Confirm] []


DESCRIPTION
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
-VMHost
Specify the host to which you want to add the new adapter.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-PortGroup
Specify the port group to which you want to add the new adapter.

Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false

-PortKey
Specify the port of the virtual switch to which you want to connect the network adapter. Use this parameter onl
y if the -VirtualSwitch parameter is specified.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-VirtualSwitch
If the specified port group is non-existent, use this parameter to specify on which virtual switch you want to
add the new network adapter.

Required? true
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? true

-IP
Specify an IP address for the new network adapter. All IP addresses are specified using IPv4 dot notation. If I
P is not specified, DHCP mode is enabled. For VMKernel network adapters, the DHCP mode is supported only on vCe
nter Server 4.0, ESX 4.0, and later.

Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false

-SubnetMask
Specify a subnet mask for the new network adapter.

Required? false
Position? 5
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Mac
Specify a media access control (MAC) address for the new virtual network adapter.

Required? false
Position? 6
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Mtu
Specify the MTU size.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-ConsoleNic
If the value is $true, indicates that you want to create a service console virtual network adapter. If the valu
e is $false, indicates that you want to create a virtual host/VMkernel network adapter. Not supported on ESXi.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-VMotionEnabled []
Indicate that you want to use the new virtual host/VMKernel network adapter for VMotion.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-FaultToleranceLoggingEnabled []
Indicate that the network adapter is enabled for Fault Tolerance (FT) logging. This parameter is supported only
on ESX/vCenter Server 4.0 and later.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-IPv6ThroughDhcp
Indicate that the IPv6 address is obtained through DHCP.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-AutomaticIPv6
Indicate that the IPv6 address is obtained through a router advertisement.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-IPv6
Specify multiple static addresses using the following format: / or . If you s
kip , the default value of 64 is used.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-ManagementTrafficEnabled []
Indicate that you want to enable the network adapter for traffic management. This parameter is supported only o
n ESXi.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Server
The -Server parameter is needed when the host is specified by name. In this case, the host with the specified n
ame is searched 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
Accept pipeline input? false
Accept wildcard characters? true

-WhatIf
Indicate that the cmdlet is run only to display the changes that would be made and actually no objects are modi
fied.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

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


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
HostVirtualNic


NOTES


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

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

C:\PS>$vs = Get-VirtualSwitch -VMHost 10.23.113.111 -Name vSwitch

New-VMHostNetworkAdapter -VMHost 10.23.113.110 -PortGroup MyConsolePortGroup -VirtualSwitch $vs -ConsoleNIC -Mtu 40
00


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





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

C:\PS>$vs = Get-VirtualSwitch -VMHost (Get-VMHost 10.23.113.111) -Name "vSwitch0"

New-VMHostNetworkAdapter -VMHost (Get-VMHost 10.23.113.110) -PortGroup MyVMKernelPortGroup -VirtualSwitch $vs -IP 1
92.168.168.110 -SubnetMask 255.255.255.0


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





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

C:\PS>New-VMHostNetworkAdapter -VMHost $vmHost -VirtualSwitch $virtualSwitch -PortGroup "Service Console 1" -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 --------------

C:\PS>New-VMHostNetworkAdapter -VMHost $myHost -VirtualSwitch $virtualSwitch -PortGroup "Serveice Console 1" -IP 19
2.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 --------------

C:\PS>New-VMHostNetworkAdapter -VMHost $vmHost -VirtualSwitch $virtualSwitch -PortGroup "Service Console 1" - -IPv6
ThroughDhcp


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






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/New-VMHostNetworkAdapter.html
Remove-VMHostNetworkAdapter
Set-VMHostNetworkAdapter