Deploying an OVF/OVA file

1.9k Views Asked by At

Deploying an OVF/OVA file to a remote ESXi server

  • I am trying to deploy an OVF/OVA file to a remote ESXi server.
  • I want to do this from the command line.
  • I have written a simple batch file which deploys the ovf using ovftool.exe.

Here is my batch file:

    @echo off
    CLS
    set OVF_COMMAND="C:\Program Files (x86)\VMware\VMwareWorkstation\OVFTool\ovftool.exe"
    set OVF_DEPLOY_OFF=ovftool 

    IF NOT EXIST %OVF_COMMAND% (
        @echo powershell does not exists at:
        @echo %OVF_COMMAND%
        pause
    ) 

    @echo START OF THE BATCH SCRIPT
    @echo         ###############**strong text**######################################################## 

    %OVF_DEPLOY_OFF%  --noSSLVerify --disableVerification --skipManifestGeneration C:\Newfolder\vAppTS2\vAppTS2.ovf         vi://administrator:[email protected]/nrtms-training/host/141.192.91.9/


    @echo ####################################################################### 

This works fine, but it is too slow. The OVF file comprises of one vApp with one VM. When all will be done the vApp will contain about 9 VMs. It takes about 20 minutes to deploy the the current vApp which contains only one VM. I cannot imagine how long it will take to deploy a vApp with 9 VMs. Is it a way to make it faster? Cheers.

1

There are 1 best solutions below

0
On

I have managed to find work-around. Instead of importing a ovf file from some remote location I have chosen to clone that vApp from a predefined resource pool.

So at the beginning I have created a resource pool on which I have uploaded a vApp.

//connect to server
Connect-VIServer -Server $args[2].ToString() -Username $args[3] -Password $args[4]
// search which vApp to move into the new source pool
// The name of the vApp is given as an argument to the powerCLI script
// It must be one of the existing vApps

foreach ($vApps in (Get-vApp ) )
{
   if ($vApps.name -eq $args[0])
   {
        # defined source and destination hosts
        $vmHost_dest   = Get-VMHost -Name "100.106.37.10"
        $vmHost_source = Get-VMHost -Name "100.106.37.9"

        # create a resource pool on destination host
       $myDestinationRP = New-ResourcePool -Name "datastore-13" -Location $vmHost_dest
        New-VApp -Name MyVApp2 -VApp $vApps -Location $myDestinationRP  
   }
}

So I can build a custom vApp and store it to a specific source pool from where I can clone it later on as I please. If I want to remove the newly cloned vApp I can do as followS:

Get-VApp $vApps | Remove-VApp -Confirm:$false

Hope this helps