PowerCLI Reference

Export-VApp

Synopsis

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

Syntax

Export-VApp [[-Destination] <String>] [-VApp] <VApp[]> [-CreateSeparateFolder] [-Description <String>] [-Force] [-Format <VAppStorageFormat>] [-Name <String>] [-RunAsync] [-Server <VIServer[]>] [-Confirm] [-WhatIf] [<CommonParameters>]

Export-VApp [[-Destination] <String>] [-CreateSeparateFolder] [-Description <String>] [-Force] [-Format <VAppStorageFormat>] [-Name <String>] [-RunAsync] [-Server <VIServer[]>] -VM <VirtualMachine[]> [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version
Get-VApp
Import-VApp
New-VApp
Remove-VApp
Set-VApp
Start-VApp
Stop-VApp
Move-VApp

Detailed Description

This cmdlet exports a vApp or a single virtual machine to the specified destination. If no destination is specified, the cmdlet creates a new folder in the current working directory and exports the vApp or the virtual machine to it. The name of the new folder is the same as the name of the vApp or the virtual machine as it appears in vCenter Server.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
DestinationStringSpecifies a destination path to the file system location where you want to export the vApp or the virtual machine. If the value of the Destination parameter is a folder, the vApp or the virtual machine is exported to a container folder (OVF). If the destination is a file, the vApp or the virtual machine is exported in OVA format.falseFalse
VAppVApp[]Specifies the vApp that you want to export.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
CreateSeparateFolderSwitchParameterIndicates that you want to create a separate folder for each vApp or virtual machine.falseFalse
DescriptionStringProvides a description of the exported vApp or virtual machine.falseFalse
ForceSwitchParameterIndicates that the cmdlet overwrites the existing destination files and creates directories to complete the specified file path.falseFalse
FormatVAppStorageFormatSpecifies the file format of the specified vApp or virtual machine. The default format is OVF. The valid values are OVF and OVA.falseFalse
NameStringSpecifies a name for the exported vApp or virtual machine.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
VMVirtualMachine[]Specifies the virtual machine that you want to export.trueTrue (ByValue)
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse

Return Type

Zero or more FileInfo objects

Notes

Examples

-------------------------- Example 1 --------------------------

Get-VApp -Name "MyVApp*" | Export-VApp -Destination "C:\vapps\"

Retrieves all vApps whose names start with "MyVApp" and exports them to the specified path.

-------------------------- Example 2 --------------------------

$myVApp = Get-VApp -Name "MyVApp1" 
Export-VApp -Destination "C:\NewFolder\" -VApp $myVApp -Name "EMail_vApp" -Force

Exports the vApp in the $myVApp variable to the specified location and assigns a name to the folder.

-------------------------- Example 3 --------------------------

$myVApp = Get-VApp -Name "MyVApp1" 
Export-VApp -vApp $myVApp -Destination "C:\vapps\Vapp\" -Force -CreateSeparateFolder:$false

Exports the vApp in the $myVApp variable to the specified location without creating a separate folder for each virtual appliance.

-------------------------- Example 4 --------------------------

$myVApp = Get-VApp -Name "MyVApp1" 
Export-VApp -vApp $myVApp -Destination "C:\vapps\myVapp\" -Format Ova

Exports a vApp in OVA format.

-------------------------- Example 5 --------------------------

Get-VM -Name MyVM* | Export-VApp -Destination "C:\MyVMs\"

Retrieves all virtual machines whose names start with "MyVM" and exports them to the specified path.

-------------------------- Example 6 --------------------------

$myVM = New-VM -Name MyVM1 -VMHost MyVMHost1
Export-VApp -Destination "C:\MyVMs\" -VM $myVM -Format Ova

Creates a new virtual machine and exports it in OVA format.

-------------------------- Example 7 --------------------------

$myVM = New-VM -Name "MyVM1" -VMHost MyVMHost1
Get-VM -Name MyVM | Export-VApp -Destination "C:\MyVMs\"
Export-VApp -Destination "C:\MyVMs\" -VM $myVM -Force

Exports a virtual machine to the same path twice. The second time forces an override of the previously exported files.


Copyright © VMware, Inc. All rights reserved.