Import-VApp Command | Vmware PowerCLI Reference

Import-VApp

This cmdlet imports OVF (Open Virtualization Format) and OVA packages. The package can contain a vApp or a virtual machine. The cmdlet returns a VApp object when the OVF contains a vApp and a VirtualMachine object when the OVF contains a single virtual machine.

Syntax

Import-VApp
[ -VMHost ] < VMHost >
-Source < String >
[ [-Name ] < String > ]
[-Datastore < StorageResource > ]
[-DiskStorageFormat < VirtualDiskStorageFormat > ]
[-Force ]
[-InventoryLocation < FolderContainer > ]
[-Location < VIContainer > ]
[-OvfConfiguration < Hashtable > ]
[-ProgressAction < ActionPreference > ]
[-RunAsync ]
[-Server < VIServer[] > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VMHost VMHost 2
  • pipeline
  • wildcards
Specifies a host where you want to run the vApp or virtual machine.
required
Source String named
Specifies the path to the OVF or OVA package that you want to import.
optional Name String 1
Specifies a name for the imported vApp or virtual machine.
optional Datastore StorageResource named
  • wildcards
Specifies a datastore or a datastore cluster where you want to store the vApp or virtual machine.
optional DiskStorageFormat VirtualDiskStorageFormat named
Specifies the storage format for the disks of the imported VMs. By default, the storage format is thick. When you set this parameter, you set the storage format for all virtual machine disks in the OVF package. This parameter accepts Thin, Thick, and EagerZeroedThick values.
optional Force SwitchParameter named
Indicates that you want to import an OVF or OVA package even if the package signature cannot be verified or if the checksum validation algorithm is not supported.
optional InventoryLocation FolderContainer named
  • wildcards
Specifies a datacenter or a virtual machine folder where you want to place the new vApp. This folder serves as a logical container for inventory organization. The Location parameter serves as a compute resource that powers the imported vApp.
optional Location VIContainer named
  • wildcards
Specifies a vSphere inventory container where you want to import the vApp or virtual machine. It must be a vApp, a resource pool, or a cluster.
optional OvfConfiguration Hashtable named
Specifies values for a set of user-configurable OVF properties.
optional ProgressAction ActionPreference named
optional RunAsync SwitchParameter named
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the RunAsync parameter run "help About_RunAsync" in the VMware PowerCLI console.
optional Server VIServer[] named
  • wildcards
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.

Output

VMware.VimAutomation.ViCore.Types.V1.Inventory.VApp

Examples

Example 1

$vmHost = Get-VMHost -Name "MyVMHost1"
Import-vApp -Source "c:\vApps\WebServer\WebServer.ovf" -VMHost $vmHost

Imports an OVF package by specifying the target host and name.

Example 2

$myCluster = Get-Cluster -Name "MyCluster1"
$vmHost = Get-VMHost -Name "MyVMHost1"
Import-vApp -Source "c:\vApps\WebServer\WebServer.ovf" -VMHost $vmHost -Location $myCluster -Name "MyWebServerProduction1"

Imports an OVF package within a cluster.

Example 3

$vmHost = Get-VMHost -Name "MyVMHost1"
$myDatastore = Get-Datastore -Name "MyDatastore1"
$vmHost | Import-vApp -Source "c:\vApps\WebServer\WebServer.ovf" -Datastore $myDatastore

Imports an OVF package by specifying a datastore where to store the virtual machines.

Example 4

$myDatastore = Get-Datastore -Name "MyDatastore1"
$vmHost = Get-VMHost -Name "MyVMHost1"
$vmHost | Import-vApp -Source "c:\vApps\WebServer\WebServer.ova" -Datastore $myDatastore -Force

Imports an OVA package even if the package signature cannot be verified.

Example 5

$ovfConfig = Get-OvfConfiguration "myOvfTemplate.ovf"
$ovfConfig.NetworkMapping.Network.Value = "Network 2"
$ovfConfig.vami.VM_1.ip0.Value = "10.23.101.2"
$ovfConfig.vami.VM_2.ip0.Value = "10.23.101.3"
Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost $vmHost

Imports an OVF package with specified network mapping and two standard OVF properties.

Example 6

$ovfConfig = Get-OvfConfiguration "myOvfTemplate.ovf"
$portGroup = Get-VirtualPortGroup -Name "Network 2" -Standard
$ovfConfig.NetworkMapping.Network.Value = $portGroup
Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost $vmHost

Imports an OVF package by specifying network mapping with a standard port group object.

Example 7

$ovfConfig = Get-OvfConfiguration "myOvfTemplate.ovf"
$vdPortGroup = Get-VDPortgroup "myDistributedPortGroup"
$ovfConfig.NetworkMapping.Network.Value = $vdPortGroup
Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost $vmHost

Imports an OVF package by specifying network mapping with a distributed port group object.

Example 8

$ovfConfig.ToHashTable()
$ovfConfig = @{
   "NetworkMapping.VM Test Network"="Network 2";
   "vami.ip0.VM_1"="10.23.101.2";
   "vami.ip0.VM_2"="10.23.101.3"
}
Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost $vmHost

Imports an OVF package by specifying a hash table with populated OVF properties to the OvfConfiguration parameter.

Related Commands

VApp

This cmdlet exports a vApp or a single virtual machine to the specified destination.

This cmdlet retrieves vApps.

This cmdlet imports OVF (Open Virtualization Format) and OVA packages. The package can contain a virtual appliance or a virtual machine.

This cmdlet moves the specified virtual appliances to a new location.

This cmdlet creates a new vApp.

This cmdlet removes vApps from the server.

This cmdlet modifies the specified vApp.

This cmdlet starts vApps.

This cmdlet stops vApps.