I am working with 2 ESXi servers and a single vCenter server with vSphere 6.0 update 1b; and PowerCLI 6.0 Release 2
I have a one datacenter, cluster, vCenter and one vDS. I need to move the vCenter datastore to a different one and am getting the error:
"Move-VM The VM that you move must be managed by the same VI Server as the destination container and datastore"
Code looks like the following:
$vctObj = connect-viserver $vctIPaddress
$esx1Obj = connect-viserver $esx1IPaddress
$esx2Obj = connect-viserver $esx2IPaddress
$vmObj = get-vm -name $vmname -Server $vctObj
$destDSobj = get-datastore -name $destDSname
move-vm -vm $vmObj -Datastore $destDSobj -DiskStorageFormat "Thin"
I can successfully migrate the VM's datastore from vCenter via the VI Client, but PowerCLI has me stumped.
Maureen
Try using the Server parameter on the Get-Datastore line
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
No need to connect to ESXi hosts as you are already connected to Vcenter.
Disconnect yourself from ESXi hosts.
Disconnect-viserver $esx1IPaddress
Disconnect-viserver $esx2IPaddress
Try again..
I disconnected from the the servers, but it didn't change the error.
Try using the Server parameter on the Get-Datastore line
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc, thank you SOO much, I tried so many variations, all I had to do was add a -server option on the Get-Datastore cmdlet.
$vctObj = connect-viserver $vctIPaddress
$esx1Obj = connect-viserver $esx1IPaddress
$esx2Obj = connect-viserver $esx2IPaddress
$vmObj = get-vm -name $vmname -Server $vctObj
$destDSobj = get-datastore -name $destDSname -Server $vctObj
move-vm -vm $vmObj -Datastore $destDSobj -DiskStorageFormat "Thin"
Hi LucD,
I am trying to perform the same operation, but using vCenter 6.x planning to migrate VM (compute only) from source vcenter to destination vcenter. I verified powercli config to be multiple and connected to multiple vcenter, but getting the below error message, does powercli recognizes the vsphere 6.xs enhanced vmotion? I verified this functionality in vSphere client and it is successfully, not able to figure it out in Powercli. getting the same error "The VM that you move must be managed by the same VI Server as the destination container and datastore"
Script
$sourcecluster = Get-Cluster "mysourcecluster" -Server mysourcevc
$destcluster = Get-Cluster "mydestcluster" -Server mydestvc
$vm = Get-VM myvm -Server mysourcevc
Move-VM -Destination $destcluster -VM $vm
i am attempting just compute vmotion, storage is shared
Are the two vCenters in different SSO domains ?
If yes, William did a post on that, see Did you know of an additional cool vMotion capability in vSphere 6.0?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Infact they are not in two SSO domain, hence I opted for the relatively simpler powercli script. I did see William's post, was exploring other straight forward scripts. Thanks for getting back.
Did you also try with the Server parameter (source vCenter) on the Move-VM cmdlet ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yep, same result.