Set-VMHostNetworkAdapter Command | Vmware PowerCLI Reference

Set-VMHostNetworkAdapter

This cmdlet configures the specified host network adapter. For a physical NIC, you can change the duplex and the bit rate settings (10, 100, 1000, 10000). For a regular virtual NIC, you can change the IP address and the subnet mask. For a console virtual NIC, you can modify the IP and the subnet mask, or choose DHCP mode.

Syntax

Set-VMHostNetworkAdapter
-PortGroup < DistributedPortGroup >
-VirtualNic < HostVirtualNic[] >
[-ProgressAction < ActionPreference > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
PortGroup DistributedPortGroup named
Specifies a distributed port group to which you want to connect the host network adapter. You can use this parameter only to migrate a virtual network adapter from a standard port group to a distributed port group.
required
VirtualNic HostVirtualNic[] named
  • pipeline
Provide a list of the host network adapters you want to configure.
optional ProgressAction ActionPreference named
Set-VMHostNetworkAdapter
-PhysicalNic < PhysicalNic[] >
[-AutoNegotiate ]
[-BitRatePerSecMb < Int32 > ]
[-Duplex < String > ]
[-ProgressAction < ActionPreference > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
PhysicalNic PhysicalNic[] named
  • pipeline
Specifies the PhysicalNIC objects you want to update.
optional AutoNegotiate SwitchParameter named
Indicates that the host network adapter speed/duplex settings are configured automatically. Use this parameter only if the Duplex and BitRatePerSecMb parameters are not set.
optional BitRatePerSecMb Int32 named
Specifies the bit rate of the link. Only valid when configuring a physical NIC. Use this parameter only if the AutoNegotiate parameter is not set. Note that updating the speed (BitRatePerSec) of a physical NIC might take some time due to the hardware configuration being performed, and the returned object might still contain the current configuration instead of the updated one.
optional Duplex String named
Indicates whether the link is capable of full-duplex. The valid values are Full and Half. You can set this parameter only when updating a PhysicalNIC. Use this parameter only if the AutoNegotiate parameter is not set.
optional ProgressAction ActionPreference named
Set-VMHostNetworkAdapter
-VirtualNic < HostVirtualNic[] >
[-AutomaticIPv6 < Boolean > ]
[-Dhcp ]
[-FaultToleranceLoggingEnabled < Boolean > ]
[-IP < String > ]
[-IPv6 < String[] > ]
[-IPv6Enabled < Boolean > ]
[-IPv6ThroughDhcp < Boolean > ]
[-Mac < String > ]
[-ManagementTrafficEnabled < Boolean > ]
[-Mtu < Int32 > ]
[-ProgressAction < ActionPreference > ]
[-ProvisioningEnabled < Boolean > ]
[-SubnetMask < String > ]
[-VMotionEnabled < Boolean > ]
[-VSphereBackupNfcEnabled < Boolean > ]
[-VSphereReplicationEnabled < Boolean > ]
[-VSphereReplicationNfcEnabled < Boolean > ]
[-VsanTrafficEnabled < Boolean > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VirtualNic HostVirtualNic[] named
  • pipeline
Provide a list of the host network adapters you want to configure.
optional AutomaticIPv6 Boolean named
Indicates that the IPv6 address is obtained through a router advertisement.
optional Dhcp SwitchParameter named
Indicates whether the host network adapter uses a Dhcp server. This parameter works only on ESXi hosts. For VMKernel adapters, Dhcp is supported only on ESX 4.1 and later.
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 IP String named
Specifies an IP address for the network adapter using an IPv4 dot notation. If the NIC has no subnet mask previously defined, you must also set the SubnetMask parameter. If the IP parameter is not specified, DHCP mode is enabled. Only valid when configuring a virtual NIC.
optional IPv6 String[] named
Specifies 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. Specifying a value for IPv6 parameter overrides the current configuration. To clear all configured static IP addresses, pass an empty array to the IPv6 parameter.
optional IPv6Enabled Boolean named
Indicates that IPv6 configuration is enabled. Setting this parameter to $false deactivates all IPv6-related parameters. If the value is $true", you need to provide values for at least one of the IPv6ThroughDhcp, AutomaticIPv6, and IPv6 parameters.
optional IPv6ThroughDhcp Boolean named
Indicates that the IPv6 address is obtained through DHCP.
optional Mac String named
Specifies the media access control (MAC) address of the virtual network adapter. Only valid when configuring a virtual NIC.
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.
optional ProgressAction ActionPreference named
optional ProvisioningEnabled Boolean named
Specifies whether vSphere Provisioning is enabled on this network adapter.
optional SubnetMask String named
Specifies a subnet mask for the NIC. If the NIC has a subnet mask previously defined, specifying the SubnetMask parameter when configuring the IP address is not mandatory unless you want to modify the mask. Only valid when configuring a virtual NIC.
optional VMotionEnabled Boolean named
Indicates that you want to use the virtual host/VMKernel network adapter for VMotion.
optional VSphereBackupNfcEnabled Boolean named
Specifies whether backup through NFC is enabled on this network adapter. This parameter is supported in vSphere 7.0 and later.
optional VSphereReplicationEnabled Boolean named
Specifies whether vSphere Replication traffic is enabled on this network adapter.
optional VSphereReplicationNfcEnabled Boolean named
Specifies whether vSphere Replication Network File Copy (NFC) traffic is enabled on this network adapter.
optional VsanTrafficEnabled Boolean named
Specifies whether Virtual SAN traffic is enabled on this network adapter.

Output

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

Examples

Example 1

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

Get-VMHost Host | Get-VMHostNetworkAdapter -VMKernel | Set-VMHostNetworkAdapter -VMotionEnabled $true

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

Example 3

Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv6Enabled $false

Deactivates the IPv6 support on a network adapter.

Example 4

Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv6ThroughDhcp $true

Configures a network adapter to obtain IPv6 through DHCP.

Example 5

Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -AutomaticIPv6 $true

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

Example 6

Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv6 $ipv6Address

Changes the IPv6 address of a network adapter.

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.

VMHostAttributes

Gets the identifying attributes 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.

VMHostImageProfile

Gets the image profile associated with the specified ESXi host.

VMHostMatchingRules

Retrieves the list of rules in the rule set that match a specified host.

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.