## 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

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Source | String | Specifies the path to the OVF or OVA package that you want to import. | true | false
Name | String | Specifies a name for the imported vApp or virtual machine. | false | false
VMHost | VMHost | Specifies a host where you want to run the vApp or virtual machine. | true | true (ByValue)
Confirm | SwitchParameter | If 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. | false | false
Datastore | StorageResource | Specifies a datastore or a datastore cluster where you want to store the vApp or virtual machine. | false | false
DiskStorageFormat | VirtualDiskStorageFormat | 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. | false | false
Force | SwitchParameter | 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. | false | false
InventoryLocation | FolderContainer | 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. | false | false
Location | VIContainer | 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. | false | false
OvfConfiguration | Hashtable | Specifies values for a set of user-configurable OVF properties. | false | false
RunAsync | SwitchParameter | 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. | false | false
Server | VIServer[] | 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. | false | false
WhatIf | SwitchParameter | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | false

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.