< Back

Set-NetworkAdapter

Sun Jan 19, 2020 7:08 pm

NAME Set-NetworkAdapter



SYNOPSIS

This cmdlet modifies the configuration of the virtual network adapter.





SYNTAX

Set-NetworkAdapter [-NetworkAdapter] <NetworkAdapter[]> [-Connected <Boolean>] [-MacAddress <String>]

[-NetworkName <String>] [-RunAsync] [-Server <VIServer[]>] [-StartConnected <Boolean>] [-Type

<VirtualNetworkAdapterType>] [-WakeOnLan <Boolean>] [-Confirm] [-WhatIf] [<CommonParameters>]



Set-NetworkAdapter [-NetworkAdapter] <NetworkAdapter[]> [-Connected <Boolean>] -DistributedSwitch

<DistributedSwitch> [-MacAddress <String>] -PortId <String> [-RunAsync] [-Server <VIServer[]>] [-StartConnected

<Boolean>] [-Type <VirtualNetworkAdapterType>] [-WakeOnLan <Boolean>] [-Confirm] [-WhatIf] [<CommonParameters>]



Set-NetworkAdapter [-NetworkAdapter] <NetworkAdapter[]> -Portgroup <VirtualPortGroupBase> [-RunAsync] [-Server

<VIServer[]>] [-Confirm] [-WhatIf] [<CommonParameters>]





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

-Connected <Boolean>

If the value is $true, the virtual network adapter is connected after its creation. If the value is $false, it

is disconnected.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DistributedSwitch <DistributedSwitch>

Specifies a virtual switch to which you want to connect the network adapter.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-MacAddress <String>

Specifies an optional MAC address for the virtual network adapter.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-NetworkAdapter <NetworkAdapter[]>

Specifies the virtual network adapter you want to configure.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Portgroup <VirtualPortGroupBase>

Specifies a standard or a distributed port group to which you want to connect the network adapter.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? 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.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Type <VirtualNetworkAdapterType>

Specifies the type of the network adapter. The valid types are e1000, Flexible, Vmxnet, EnhancedVmxnet, and

Vmxnet3, and Unknown.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-WakeOnLan <Boolean>

Indicates that wake-on-LAN is enabled on the virtual network adapter.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



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



Required? false

Position? named

Default value $true

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are

modified.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Zero or more modified NetworkAdapter objcts







NOTES









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



RELATED LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... apter.html

Get-NetworkAdapter

New-NetworkAdapter

Remove-NetworkAdapter