powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Set-NetworkAdapter



NAME
Set-NetworkAdapter

SYNOPSIS
Changes the configuration of the virtual network adapter.

SYNTAX
Set-NetworkAdapter [-NetworkAdapter] [-MacAddress ] [-NetworkName ] [-StartConne
cted []] [-Connected []] [-WakeOnLan []] [-Type ] [-PortKey <
String>] [-DistributedSwitch ] [-Server ] [-WhatIf] [-Confirm] []


DESCRIPTION
Changes 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
-NetworkAdapter
Specify the virtual network adapter you want to configure.

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

-MacAddress
Specify an optional MAC address for the virtual network adapter.

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

-NetworkName
Specify the name of the network to which you want to connect the virtual network adapter.

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

-StartConnected []
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
Accept pipeline input? false
Accept wildcard characters? false

-Connected []
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
Accept pipeline input? false
Accept wildcard characters? false

-WakeOnLan []
Indicate that wake-on-LAN is enabled on the virtual network adapter.

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

-Type
Specify the type of the network adapter. The valid types are e1000, Flexible, Vmxnet, EnhancedVmxnet, and Vmxne
t3, and Unknown.

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

-DistributedSwitch
Specify a virtual switch to which you want to connect the network adapter.

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

-Server
Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the co
mmand runs on the default servers. For more information about default servers, see the description of Connect-V
IServer.

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
NetworkAdapter


NOTES




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

C:\PS>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 --------------

C:\PS>Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -Type EnhancedVmxnet


Sets the type of the virtual network adapter.





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

C:\PS>Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -Connected:$true


Sets the connection state of the virtual network adapter.





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

C:\PS>$distributedSwitch = Get-VirtualSwitch -Distributed -Name DistributedSwitch

Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -PortKey 100 -DistributedSwitch $distributedSwitch


Connects a virtual network adapter to a distributed switch by specifying an available port key.





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

C:\PS>$distributedSwitchPortGroup = Get-VirtualSwitch -Distributed -Name DistributedSwitch | Get-VirtualPortGroup -
Name PortGroup

Get-VM VM | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName $distributedSwitchPortGroup.Name


Connects a virtual network adapter to a distributed switch by specifying the network name.






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