Hi ,
I have a requirement to move VMs from one esxi to other esxi with Move-VM but unable to figure out if we have more NICs on VM like 3 , 4 , 5 ,6 NICs , is it possible to move to right adapter to right port group. below is the script in my mind kindly help.
$networkAdapter = Get-NetworkAdapter -vm VMname
if ($networkAdapter.Count -ge 1) {
foreach ( $nadapter in $networkAdapter) {
$destinationPortGroup = Get-VDPortgroup -VDSwitch 'NewvDS' -Name "$($nadapter.NetworkName)-new"
Move-VM -VM VMname -Destination Esxiserver -NetworkAdapter $nadapter -PortGroup $destinationPortGroup -WhatIf
}
}