powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Set-VMHostNetworkAdapter



NAME
Set-VMHostNetworkAdapter

SYNOPSIS
Configures the specified host network adapter.

SYNTAX
Set-VMHostNetworkAdapter -PhysicalNic [-Duplex ] [-BitRatePerSecMb ] [-AutoNegotiate
] [-WhatIf] [-Confirm] []

Set-VMHostNetworkAdapter -VirtualNic [-Dhcp] [-IP ] [-SubnetMask ] [-Mac >] [-Mtu ] [-VMotionEnabled []] [-FaultToleranceLoggingEnabled []] [-ManagementTrafficEnab
led []] [-IPv6ThroughDhcp []] [-AutomaticIPv6 []] [-IPv6 ] [-IPv6Enabled [ lean>]] [-WhatIf] [-Confirm] []


DESCRIPTION
Configures the specified host network adapter. For a physical NIC, you can change the duplex and the bit rate setti
ngs (10, 100, 1000, 10000). For a regular virtual NIC, you can change the IP address and the subnet mask. For a con
sole virtual NIC, you can modify the IP and the subnet mask, or choose DHCP mode.


PARAMETERS
-PhysicalNic
Provide a list of the PhysicalNIC objects you want to update.

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

-Duplex
Indicate whether the link is capable of full-duplex. The valid values are "full" and "half". Only valid when up
dating a PhysicalNIC. Use this parameter only if the -AutoNegotiate parameter is not set.

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

-BitRatePerSecMb
Specify the bit rate of the link. Only valid when configuring a physical NIC. Use this parameter only if the -A
utoNegotiate parameter is not set. Note that updating the speed (BitRatePerSec) of a physical NIC might take so
me time due to the hardware configuration being performed, and the returned object might still contain the curr
ent configuration instead of the updated one.

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

-AutoNegotiate
Indicate that the host network adapter speed/duplex settings are configured automatically. Use this parameter o
nly if the -Duplex and -BitRatePerSecMb parameters are not set.

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

-WhatIf
Shows the effects of the command without running it.

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

-Confirm
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 $true
Accept pipeline input? false
Accept wildcard characters? false

-VirtualNic
Provide a list of the host network adapters you want to configure.

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

-Dhcp
Indicate whether the host network adapter uses a Dhcp server. This parameter works only on ESXi hosts. For VMKe
rnel adapters, Dhcp is supported only on ESX 4.0 and later.

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

-IP
Specify an IP address for the network adapter using an IPv4 dot notation. If the NIC has no subnet mask previou
sly defined, you must also set the SubnetMask parameter. If the IP parameter is not specified, DHCP mode is ena
bled. Only valid when configuring a virtual NIC.

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

-SubnetMask
Specify a subnet mask for the NIC. If the NIC has a subnet mask previously defined, specifying the SubnetMask p
arameter when configuring the IP address is not mandatory unless you want to modify the mask. Only valid when c
onfiguring a virtual NIC.

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

-Mac
Specifies the media access control (MAC) address of the virtual network adapter. Only valid when configuring a
virtual NIC. On vCenter Server 2.5/ ESX 3.5, changing the MAC address of a VMKernel network adapter modifies th
e DeviceName property of the adapter. This might cause problems if you try to retrieve the network adapter afte
r modifying its MAC address.

Required? false
Position? named
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

-VMotionEnabled []
Indicate that you want to use the 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

-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

-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 static addresses using the following format: / or . If you skip et_prefix_length>, the default value of 64 is used. Specifying value for IPv6 parameter overrides the current c
onfiguration. To clear all configured static IP addresses, pass an empty array to the IPv6 parameter.

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

-IPv6Enabled []
Indicate that IPv6 configuration is enabled. Setting this parameter to "false" disables all IPv6-related parame
ters. If the value is $true", you need to provide values for at least one of the IPv6ThroughDhcp, AutomaticIPv6
, and IPv6 parameters.

Required? false
Position? named
Default value
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
PhysicalNic or 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.

On ESX 3.x/vCenter 2.x, Set-VMHostNetworkAdapter might take longer to update the values of the FullDuplex and
BitRatePerSec network adapter properties due to the hardware configuration being performed, and the returned ob
ject might still contain the current configuration instead of the updated one.

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

C:\PS>$vswitch = New-VirtualSwitch -VMHost 10.23.112.234 -Name VSwitch

$nic = New-VMHostNetworkAdapter -VMHost 10.23.112.234 -PortGroup PortGroup -VirtualSwitch $vswitch -IP 10.23.123.2
34 -SubnetMask 255.255.254.0

Set-VMHostNetworkAdapter -VirtualNIC $nic -IP 10.23.112.245 -SubnetMask 255.255.255.0 -Mtu 4000


Updates the network adapter IP address, Subnet mask, and MTU size.





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

C:\PS>Get-VMHost Host | Get-VMHostNetworkAdapter -VMKernel | Set-VMHostNetworkAdapter -VMotionEnabled $true


Enable VMotion on all VMKernel network adapters on the specified host.





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

C:\PS>Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv
6Enabled $false


Disables the IPv6 support on a network adapter.





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

C:\PS>Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv
6ThroughDhcp $true


Configures a network adapter to obtain IPv6 through DHCP.





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

C:\PS>Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -Aut
omaticIPv6 $true


Configures a network adapter to obtain IPv6 by a router advertisement.





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

C:\PS>Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv
6 $ipv6Address


Changes the IPv6 address of a network adapter.






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