I am using the MOVE-VM command to perform automatic migrations of VMs from one vCenter to another. I have some VMs that have disks split across multiple datastores. How do I specify which target vCenter datastores to place my disks on?
Afaik you cannot do this with the Move-VM cmdlet. It only accepts a single datastore as destination.
You should be able to do it using the RelocateVM_Task of the VirtualMachine SDK object.
You would need to build a VMware.Vim.VirtualMachineRelocateSpec object for the virtual machines config files specifying the destination datastore MoRef. Then add a VMware.Vim.VirtualMachineRelocateSpecDiskLocator object for each VMDK specifying its DiskID and Datastore MoRef from the destination.
I tried to use the script (I changed some parameters), but the vm relocation failed with
"Authenticity of the host's SSL certificate is not verified."
9/27/2023 10:14:46 PM Wait-Task The operation for the entity "MasterImagew11v2" failed with the following message: "Authenticity of the host's SSL certificate is not verified."
This is my settings
The certificate error is shown when starting the relocation and I saw this error on vcenter event:
I'll give you two pieces of information: my goal is to move VMs from an infrastructure with vCenter 6.7 to one with vCenter 7u3. The two vCenters are not in Enhanced Linked Mode and see the same LUNs (my goal is to do a vMotion without interruption of service). From Web Gui everything works, the only problem is that I have to migrate hundreds of VMs.
There can be many possible causes, have a look at the options in Re: Authenticity of the host's ssl certificate is ... - VMware Technology Network VMTN