Syntax
Set-NetworkAdapter [-NetworkAdapter] <NetworkAdapter[]> [-MacAddress <String>] [-NetworkName <String>] [-StartConnected <Boolean>] [-Connected <Boolean>] [-WakeOnLan <Boolean>] [-Type <VirtualNetworkAdapterType>] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]Related Commands
Online versionDetailed Description
This cmdlet modifies the configuration of the virtual network adapter. You can change the MAC address and the network name, and to configure the Connected, StartConnected, and WakeOnLan properties of the adapter.Parameters
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
NetworkAdapter | NetworkAdapter[] | Specifies the virtual network adapter you want to configure. | true | true (ByValue) | |
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. | false | false | |
Connected | Boolean | If the value is $true, the virtual network adapter is connected after its creation. If the value is $false, it is disconnected. | false | false | |
DistributedSwitch | DistributedSwitch | Specifies a virtual switch to which you want to connect the network adapter. | true | false | |
MacAddress | String | Specifies an optional MAC address for the virtual network adapter. | false | false | |
NetworkName | String | Specifies the name of the network to which you want to connect the virtual network adapter. Specifying a distributed port group name is obsolete. Use the Portgroup parameter instead. | false | false | |
Portgroup | VirtualPortGroupBase | Specifies a standard or a distributed port group to which you want to connect the network adapter. | true | false | |
PortId | String | Specifies the port of the virtual switch to which you want to connect the network adapter. Use this parameter only if the DistributedSwitch parameter is specified. | true | false | |
RunAsync | SwitchParameter | Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the RunAsync parameter run "help About_RunAsync" in the VMware PowerCLI console. | false | false | |
Server | VIServer[] | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | false | false | |
StartConnected | Boolean | If the value is $true, the virtual network adapter starts connected when its associated virtual machine powers on. If the value is $false, it starts disconnected. | false | false | |
Type | VirtualNetworkAdapterType | Specifies the type of the network adapter. The valid types are e1000, Flexible, Vmxnet, EnhancedVmxnet, and Vmxnet3, and Unknown. | false | false | |
WakeOnLan | Boolean | Indicates that wake-on-LAN is enabled on the virtual network adapter. | false | false | |
WhatIf | SwitchParameter | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false |
Return Type
Zero or more modified NetworkAdapter objctsNotes
Examples
-------------- Example 1 --------------
Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -MacAddress '00:50:56:a1:00:00' -WakeOnLan:$true
Configures the Mac address and the WakeOnLan setting of a virtual network adapter.
-------------- Example 2 --------------
Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -Type EnhancedVmxnet
Sets the type of the virtual network adapter.
-------------- Example 3 --------------
Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -Connected:$true
Sets the connection state of the virtual network adapter.
-------------- Example 4 --------------
$myNetworkAdapters = Get-VM | Get-NetworkAdapter -Name "Network adapter 1" $myVDPortGroup = Get-VDPortgroup -Name MyVDPortGroup Set-NetworkAdapter -NetworkAdapter $myNetworkAdapters -Portgroup $myVDPortGroup
Retrieves all network adapters named "Network adapter 1" from all virtual machines and connects them to the specified distributed port group.
-------------- Example 5 --------------
$myNetworkAdapter = Get-VM -Name MyVM | Get-NetworkAdapter -Name "Network adapter 1" $myVDSwitch = Get-VDSwitch -Name MyVDSwitch Set-NetworkAdapter -NetworkAdapter $myNetworkAdapter -DistributedSwitch $MyVDSwitch -PortId 100
Retrieves the network adapter named "Network adapter 1" added to the specified virtual machine and connects it to the specified port on the specified distributed switch.