< Back

Import-VApp

Sun Jan 19, 2020 6:57 pm

NAME 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> [[-Name] <String>] [-VMHost] <VMHost> [-Datastore <StorageResource>]

[-DiskStorageFormat <VirtualDiskStorageFormat>] [-Force] [-InventoryLocation <FolderContainer>] [-Location

<VIContainer>] [-OvfConfiguration <Hashtable>] [-RunAsync] [-Server <VIServer[]>] [-Confirm] [-WhatIf]

[<CommonParameters>]





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

-Datastore <StorageResource>

Specifies a datastore or a datastore cluster where you want to store the vApp or virtual machine.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Name <String>

Specifies a name for the imported vApp or virtual machine.



Required? false

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-OvfConfiguration <Hashtable>

Specifies values for a set of user-configurable OVF properties.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? 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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Source <String>

Specifies the path to the OVF or OVA package that you want to import.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-VMHost <VMHost>

Specifies a host where you want to run the vApp or virtual machine.



Required? true

Position? 3

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? true



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



Required? false

Position? named

Default value $true

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are

modified.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

The newly created VApp or VirtualMachine object







NOTES









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

Online Version: https://code.vmware.com/doc/preview?id= ... -VApp.html

Export-VApp

Get-VApp

New-VApp

Remove-VApp

Set-VApp

Start-VApp

Stop-VApp

Move-VApp