We need to move a VM from a PortGroup on a vDS to a PortGroup on a vSS. It is an appliance, so we can't choose a vSS, in the GUI.
When we run this script, we get the error below.
$VM0 = Get-VM -Name vmname
$ostdportgrouptouse = Get-VirtualPortGroup -VMHost $VM0.vmhost -Standard -name "vmotion-01"
Get-NetworkAdapter -VM $VM0 -Name "Network adapter 2" |
Set-NetworkAdapter -Portgroup $ostdportgrouptouse
Get-NetworkAdapter -VM $VM0
Has anyone seen this error before?
I have used this thread for reference: Set-NetworkAdapter to standard switch from DVS
Since a VSS is defined on the ESXi node level, could it be that the node where the VM is currently running, doesn't have that VSS + portgroup defined?
Did you check what is in $ostdportgrouptouse?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The $ostdportgrouptouse variable contains the portgroup we are looking for. The VM is sitting on that host and all of the hosts in that cluster and even the vCenter have the same port groups for the vMotion vmkernals.
The portgroup we want is in vSwitch2, Do we need to specify that?
No, you can't even, there is no parameter to specify a VSS on the Set-NetworkAdapter cmdlet.
Did you already try doing a vMotion of that VM to another ESXi node.
And then try your script again?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference