## 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[]> [-Name <String>] [-Force] [-Format <VAppStorageFormat>] [-CreateSeparateFolder] [-Description <String>] [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]
Export-VApp [[-Destination] <String>] -VM <VirtualMachine[]> [-Name <String>] [-Force] [-Format <VAppStorageFormat>] [-CreateSeparateFolder] [-Description <String>] [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<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

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Destination | String | Specifies 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. | false | false
VApp | VApp[] | Specifies the vApp that you want to export. | 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
CreateSeparateFolder | SwitchParameter | Indicates that you want to create a separate folder for each vApp or virtual machine. | false | false
Description | String | Provides a description of the exported vApp or virtual machine. | false | false
Force | SwitchParameter | Indicates that the cmdlet overwrites the existing destination files and creates directories to complete the specified file path. | false | false
Format | VAppStorageFormat | Specifies the file format of the specified vApp or virtual machine. The default format is OVF. The valid values are OVF and OVA. | false | false
Name | String | Specifies a name for the exported vApp or virtual machine. | 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
VM | VirtualMachine[] | Specifies the virtual machine that you want to export. | true | true (ByValue)
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

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.