Automation

 View Only
  • 1.  Powercli cross vcenter migration

    Posted Sep 27, 2023 02:06 PM

    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?



  • 2.  RE: Powercli cross vcenter migration

    Posted Sep 27, 2023 02:57 PM

    With the cmdlet you can't specify that, you will have to use API method.



  • 3.  RE: Powercli cross vcenter migration

    Posted Sep 27, 2023 06:44 PM

    Thanks LucD, 

    do you have some example to use API method?



  • 4.  RE: Powercli cross vcenter migration

    Posted Sep 27, 2023 07:18 PM

    You can start with the xMove-VM.ps1 script.

    You will have to adapt line 126 if the datastores on the target vCenter do not have the same names as the ones on the source vCenter.



  • 5.  RE: Powercli cross vcenter migration

    Posted Sep 27, 2023 08:17 PM

    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."



  • 6.  RE: Powercli cross vcenter migration

    Posted Sep 27, 2023 08:35 PM

    Did you set the InvalidCertificateAction to Ignore with the Set-PowerCliConfiguration cmdlet?



  • 7.  RE: Powercli cross vcenter migration

    Posted Sep 27, 2023 09:01 PM

    I tried setting invalidCertificateAction to Ignore (I set it on the script), but the error persists

     

     



  • 8.  RE: Powercli cross vcenter migration

    Posted Sep 27, 2023 09:46 PM

    Did you do that for all Scopes?
    And did you stop/start your PS session?



  • 9.  RE: Powercli cross vcenter migration

    Posted Sep 28, 2023 06:17 AM

    Hi LucD,

    This is my settings

    fabio1975_1-1695881555101.png

    The certificate error is shown when starting the relocation and I saw this error on vcenter event:

    fabio1975_2-1695881682498.png

    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.

     



  • 10.  RE: Powercli cross vcenter migration

    Posted Sep 28, 2023 07:14 AM

    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



  • 11.  RE: Powercli cross vcenter migration

    Posted Nov 21, 2023 09:42 AM

    Did you find a solution to the authenticity error?



  • 12.  RE: Powercli cross vcenter migration

    Posted Sep 27, 2023 03:24 PM

    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.