Home > Blogs > VMware PowerCLI Blog


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.

Import-VApp

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.

Screenshot2014091514.03.36_thumb.png

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:

Screenshot2014091513.57.35.png

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

Screenshot2014091513.53.55.png

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.

Screenshot2014091513.54.02.png

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

get-vm OVFConfig-LogInsight | Start-VM

Screenshot2014091513.55.51_thumb.png

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!

 

 

This entry was posted in Customization, General, vCenter and tagged , , on by .
Brian Graf

About Brian Graf

Brian Graf is a well-known VMware evangelist in the IT community. Over the past 5 years, Brian has done Technical Marketing for PowerCLI Automation and ESXi Lifecycle, Product Management of vCenter Distributed Resource Management features (DRS & HA), and is currently working as a Technical Marketing Manager for VMware Cloud on AWS. Brian is a co-author of the PowerCLI Deep Dive 2nd edition book. He has helped develop VMware certification courses and exams and presents around the world at VMware User Conferences, AWS Summits, Interop, as well as other industry Conferences. Brian is also a Microsoft MVP.

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

  1. James Beardsley

    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!

    James

    Reply
    1. Marcel van Os

      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.

      Reply
  2. Pingback: [VMware] news + interesting reads from the blogosphere: 22 Sept. 2014

  3. ananızı sikicem

    Very good post. I certainly appreciate this website. Continue the good work!

    Reply
  4. Anil

    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

    Reply
  5. https://file-and-password-vault.br.uptodown.com

    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

    Reply

Leave a Reply

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

*