Allright i'm stumped again. I am trying to set the network adapter on a VM from standard switch to DVS port group but keep getting errors.
Here is what I have so far:
$vm = Get-VM vmname
$vdswitch = Get-VDSwitch | where {$_.Name -eq "VSM03"}
$portgroup = Get-VDPortGroup -Name "10.10.10.x" -VDSwitch "VSM03"
Get-NetworkAdapter -VM $vm | Set-NetworkAdapter -DistributedSwitch $vdswitch -Portgroup $portgroup
Set-NetworkAdapter : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:30
+ Get-NetworkAdapter -VM $vm | Set-NetworkAdapter -DistributedSwitch $vdswitch -PortG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-NetworkAdapter], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,VMware.VimAutomation.ViCore.Cmdlets.Commands.V
irtualDevice.SetNetworkAdapter