Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 251495

Re: Set-NetworkAdapter to standard switch from DVS

$
0
0

Hello, markdjones82-

 

Typically, I would say that this would involve setting up a new VM configuration specification and using the ReconfigVM() method of a VirtualMachine object.  But, it looks like in PowerCLI version 5.1 rel 2 (released yesterday), VMware added a parameter, "Portgroup", to the Set-NetworkAdapter cmdlet.

 

So, now you should be able to do something like:

 

## get the VM upon which to act
$vm0=Get-VMmyVM0

## get the standard virtual portgroup from the VMHost on which this VM resides
$oStdPortgroupToUse=Get-VirtualPortgroup-VMHost$vm0.VMHost -Standard -Name"10.10.10.x"

#
# set the network adapter using the new -Portgroup parameter to Set-NetworkAdapter
Get-NetworkAdapter-VM$vm0-Name"Network adapter 1" | Set-NetworkAdapter -Portgroup $oStdPortgroupToUse-Confirm:$false

 

How does that do for you?

 

 

Message was edited by mattboren:  updated code to include "-Standard" param on Get-VirtualPortgroup call, as pointed out by markdjones82


Viewing all articles
Browse latest Browse all 251495

Trending Articles