I'm brand new to HCX, so have very limited experience with it.
But running into an issue on how to assign source & desination groups when there's more than one NIC, and more than one subnet.
Roughly, this is what I have:
$SrcPortgroup = ($vm | Get-virtualportgroup).Name
$DstPortgroup = (Get-VDPortgroup -VDSwitch (get-vdswitch | where {$_.Name -like "*$DstPortCluster*"}) | where {$_.Name -like "*$subnet*"}).Name #select the right vds for the right cluster with the right subnet
$SrcNetwork = Get-HCXNetwork -Name $SrcPortgroup -type DistributedVirtualPortgroup -Site $HcxSrcSite
$DstNetwork = Get-HCXNetwork -Name $DstPortgroup -type DistributedVirtualPortgroup -Site $HcxDstSite
$NetworkMapping = New-HCXNetworkMapping -SourceNetwork $SrcNetwork -DestinationNetwork $DstNetwork
$NewMigration = New-HCXMigration -VM $HcxVM -MigrationType RAV -SourceSite $HcxSrcSite -DestinationSite $HcxDstSite `
-TargetComputeContainer $DstCompute -TargetDatastore $DstDatastore -NetworkMapping $NetworkMapping
Do I just do a loop of (foreach $NIC) and make $NetworkMapping an array? or do I loop the portgroups & the $SrcPortgroup/$DstPortgroup be arrays? Or do I have to make $NewMigration an array, which seems weird to me, conceptually for just multiple NICs.