How to Export and Import a vApp

This will help you Export/Import the settings for a vApp so you can restore it if vCenter dies or if you need to migrate it to another location.
If you can power off all of your VMs an Export is easy.
Just run this and it will dump to a flat file:
 get-vapp -name “MyvApp” | export-vapp -destination “c:\temp\”

If you cannot power off your VMs or Cannot find some down time, this will do it without any interruption to your VMs.
It may seem interruptive but it works!

1) Screen cap or document all of the vapp settings. This includes the startup order, resources, and any special settings in the Advanced tab under Options. A manual backup will save you if some setting does not fully export using the API.
2) Disconnect all of the hosts and remove from inventory. (This is because you cannot export settings from a powered on vApp.)
– If you are migrating the vApp to another vcenter, just add the hosts to the new vcenter. It will disconnect them on the old vcenter without impacting the VMs.

3) Once all of the hosts that contain the vApp VMs are disconnected and removed, shutdown the vapp.
4) Export the config with this code:
 get-vapp -name “MyVapp” | export-vapp -destination “c:\temp\”

5) Enable DRS on the new cluster you want to import the vapp to. (You cannot Import a vApp without DRS enabled.)
6) Import it with this command
Import-vApp -Source “c:\temp\MyVapp.ovf” -VMHost (get-vmhost “MyHost.pcli.me”) -Location (get-cluster MyCluster) -Name “MyVapp” -force

7) Verify and edit the settings on imported vapp. (This is where your notes from step one comes in handy)
8) Move the vms into the imported Vapp. (Just drag the VMs from the host to the vApp.)
9) Once all of the VMs are in the vApp, Edit settings again and fix the startup order.

VMware Links:
https://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/Export-VApp.html
https://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/Import-VApp.html