A little history. I'm trying to migrate some VMs from a cluster running vSphere 5.1 to a new vSphere 6.0 vSAN Cluster. Via the web client, if I do a migrate both Compute & Storage option, and choose STORAGE FIRST, I can go through the wizard, choose the destination vSAN Datastore, then the host in that cluster, then the destination Network Portgroup, and I get a warning...
"Network interface" 'Network adapter 1' cannot use network 'VMNetwork_VLAN2 (vDSwitch)', because "the destination distributed switch has a different version or vendor than the source distributed switch".
Even though I get that warning, it lets me proceed.
I'm trying to automate this migration and wrote the following PowerCLI Script, however PowerCLI is failing where the Web Client doesn't.
move-vm : 9/12/2017 3:07:37 PM Move-VM The operation for the entity
"VM1" failed with the following message: "A general system error
occurred: vmodl.fault.SystemError"
At E:\ps1\vmware\Migrate.ps1:146 char:2
+ move-vm -VM (get-vm $VM) -Datastore (get-datastore "vsanDatastore
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Move-VM], SystemError
+ FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpda
tes_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM
The script:
$migrate = import-csv -path e:\ben\vmware\migrate.csv
foreach ($row in $migrate) {
# Read from CSV's Name Column
$VM = $row.Name
$Network = $row.Network
# Shutdown the VM
shutdown-vmguest $VM -confirm:$false
# Wait 15 seconds for the VM to shutdown.
start-sleep 15
# Perform the vMotion
move-vm -VM (get-vm $VM) -Datastore (get-datastore "LNvsanDatastore") -destination vmhost1.domain.com -confirm:$false
# Change the Network Adapter Portgroup
Get-VM $VM | set-networkadapter -Network Adapter "Network Adapter 1" -Networkname (Get-virtualportgroup -Name $Network) -StartConnected:$true -Confirm:$false
# Power on the VM
Start-vm (get-vm $VM) -confirm:$false
}
Please help!
Thanks in advance!
Not a real solution, but the only way I got this working in the past, was by creating a "dummy" portgroup on the source and destination hosts.
And then change the VM (on the source host) to connect to the dummy portgroup.
Then do the Move-VM, and finally move the VM (on the destination) to the correct portgroup.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Not a real solution, but the only way I got this working in the past, was by creating a "dummy" portgroup on the source and destination hosts.
And then change the VM (on the source host) to connect to the dummy portgroup.
Then do the Move-VM, and finally move the VM (on the destination) to the correct portgroup.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The web client asks you for the source portgroup, the thick client and PowerCLI don't have those options. Oh well, guess I'll be doing these by hand then. Thankfully, it's only 10 VMs.