Customization General vCenter

PowerCLI 5.8 New Feature: Import-vApp using Get-OvfConfiguration (Part 2 of 2)

in Part 1 we discussed how to add a configuration to the OvfConfiguration object (See Post HERE). In this post we will quickly discuss how to leverage the new –OvfConfiguration parameter when deploying vApps.


PowerCLI has a nice little cmdlet called ‘Import-VApp’. This cmdlet allows us to import OVF and OVA packages into vSphere. Let’s run the get-help command to see what the cmdlet requires.

get-help Import-VApp

Looking under the SYNTAX section we can get a feel for what we can do with this cmdlet.


We will use the following information to deploy Log Insight:

  • Source (location of the target vApp)
  • OvfConfiguration (our hashtable or ovfconfiguration object)
  • Name (name of our VM)
  • VMHost (where the VM will reside)
  • Datastore (which datastore we want to place Log Insight on)
  • DiskStorageFormat (I prefer to use thin)

Assuming from the previous post that we now have an OvfConfiguration object ready to deploy a vApp. Let’s take a quick look at the hash table we have:


Ok, our hashtable ($ovfconfig) looks good. Let’s now populate our VMhost and Datastore variables.

$myhost = get-cluster “Main-CL” | Get-VMHost | Where {$_.PowerState –eq “PoweredOn” –and $_.ConnectionState –eq “Connected”} | Get-Random

$datastore = $myhost | get-Datastore | Sort FreeSpaceGB –Descending | Select –first 1

We’ll Name our VM “OVFConfig-LogInsight” since I feel that is very fitting for this example.

We now have all of the information we need to deploy Log Insight. We can put all of this information together in the following command:

Import-VApp –Source $ovfpath –OvfConfiguration $ovfconfig –Name OVFConfig-LogInsight –VMHost $myhost –Datastore $datastore –DiskStorageFormat Thin


When we hit enter, we see that the vApp is importing. Now we just need to wait for it to finish importing the package into vSphere.


Once the package has imported we can then power it on using the following command:

get-vm OVFConfig-LogInsight | Start-VM


We have now successfully created the configuration of the hashtable or configuration object and deployed the vApp into our environment using PowerCLI without having to leverage external scripts or modules, Enjoy!




7 comments have been added so far

  1. Hi,
    I have followed your instructions and they worked a treat! Thankyou.
    The one issue i have is that the OVF i am deploying has a vService dependancy and won’t start because of it (vCenter Extension Service).
    Is there any way to set this in PowerCLI (Or any other CLI?).

    I’m deploying the Dell Virtual Storage Manager just for reference.

    Thankyou for your post!


    1. This seems to be a limitation of the cmdlet Import-vApp. I ran into the same issue, when deploying vSphere Replication. The Log Insight appliance doesn’t require this setting, so that’s why the example in this article doesn’t run into problems. You can fix this manually by selecting the vServices tab in the vSphere Client for the appliance, but it would be nice if you could set this using PowerCLI as well.

  2. Instead of setting Manual IP’s in the Config value , Can we pass the Parameters of the Value through a CSV file that contains all that Info . How do we do that

  3. Thiѕ is the right web site for anybody who wants tⲟ find out about this topic.
    Υou undeгstand so much its almost hard tо arցue with you (not that I personally would want to…HaHa).
    You definitely put a new spin on a topic which has been written about for
    many yeaгs. Wonderful ѕtuff, just wonderful!
    Read More Heгe : Hߋw To Really Lock Files

Leave a Reply

Your email address will not be published. Required fields are marked *