PowerCLI Reference

Import-VApp

Synopsis

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

Syntax

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

Related Commands

Online version
Export-VApp
Get-VApp
New-VApp
Remove-VApp
Set-VApp
Start-VApp
Stop-VApp
Move-VApp

Detailed Description

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.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
SourceStringSpecifies the path to the OVF or OVA package that you want to import.truefalse
NameStringSpecifies a name for the imported vApp or virtual machine.falsefalse
VMHostVMHostSpecifies a host where you want to run the vApp or virtual machine.truetrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse
DatastoreStorageResourceSpecifies a datastore or a datastore cluster where you want to store the vApp or virtual machine.falsefalse
DiskStorageFormatVirtualDiskStorageFormatSpecifies 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.falsefalse
ForceSwitchParameterIndicates 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.falsefalse
InventoryLocationFolderContainerSpecifies 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.falsefalse
LocationVIContainerSpecifies 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.falsefalse
OvfConfigurationHashtableSpecifies values for a set of user-configurable OVF properties.falsefalse
RunAsyncSwitchParameterIndicates 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.falsefalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no 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.falsefalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

The newly created VApp or VirtualMachine object

Notes

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.


Copyright © VMware, Inc. All rights reserved.