When I invoke Move-VM to migrate VMs between two ESXi hosts (7.0.2 build 18538813), both managed in the same vCenter Server (7.0.3 build 18778458), I'm receiving errors that appear to conflict.
I want to move both compute and storage from one ESXi host and datastore to a second ESXi host and datastore. Both ESXi hosts are in the same datacenter.
The manual vSphere Client steps are: Migrate > Change both compute and storage resource > Select compute > Select storage > Select networks > Select vMotion priority > Finish.
I want to reproduce that vMotion in PowerCLI. I run into errors that appear to conflict, and I'm not sure what I'm missing:
PowerCLI:
VMware.VimAutomation.Core 12.4.0.18627056
Connect-VIServer -Menu
# connect to both ESXi hosts and to vCenter Server
$vmName = 'web01.domain.tld'
$destESX = 'vm02.domain.tld'
$destDS = 'Primary-vm02'
$vm = Get-VM -Name $vmName
$esx = Get-VMHost -Datastore $destDS -Server $destESX
$ds = Get-Datastore -Name $destDS -Server $destESX
Move-VM -VM $vm -Destination $esx -Datastore $ds
When I invoke Move-VM while the ESXi hosts are managed by the vCenter Server, I get the following error:
Move-VM Access to resource settings on the host is restricted to the server that is managing it: 'x.x.x.x'
+ CategoryInfo : NotSpecified: (:) [Move-VM], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM
Following KB 2021618, I stop vpxa service and restart hostd on both ESXi servers, then establish a new Connect-VIServer session with each ESXi. When I run Move-VM again, I see this error:
Move-VM This functionality is only available when connected to VMware vCenter Server.
+ CategoryInfo : InvalidOperation: (:) [Move-VM], VimException
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_TryValidateVCConnection_ConnectedToESX,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM
I am missing something here. Can you point me in the right direction? Thanks in advance!