I am taking my esxi host and disconnecting them from a vcenter 5.5 and importing them to a vcenter 6.5. I am using distributed switch for these vm's. After I add the host into vcenter 6.5 I add it to my imported VDS. The host and vms connect with no issue and I do have the option of migrating the port groups but I have have thousands of vms to migrate. I am not losing network connectivity but I notice the network adapter as blank and does not have the proper network ( port group).
I have the script below that exports all the vm port groups to a csv but I need help with script that will import the csv and change all the vms to their proper portgroups. Some of my vms have multiple nics also.
Pull script
Connect-VIServer -Server "vcenter" -User admin -Password admin
Get-DataCenter BNA | Get-VM | Get-NetworkAdapter | Select-Object @{N="VM";E={$_.Parent.Name}},@{N="NIC";E={$_.Name}},@{N="Network";E={$_.NetworkName}} | Export-csv C:\temp\VMPortGroups.csv
Disconnect-VIServer -Server * -Force
The csv export looks like this
VM | NIC | Network |
BNALAPTL303 | Network adapter 1 | VLAN612_Development |
Thanks for any help.