This post is mainly so I have a quick reference for myself.
To export a VM as a folder of files (OVF) or a single OVA file, you can use the Export-VApp
method in PowerCLI. (It works on single VM’s, too, not just VApps. Just make sure to use the “-VM” parameter.)
From the documentation:
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.
https://vdc-repo.vmware.com/vmwb-repository/dcr-public/557aee4d-26f9-4810-bc12-b1cf22401c8f/ca9f89cf-cdea-4e9c-9e50-f214cf902c1b/doc/Export-VApp.html
But despite that behavior, I like to be precise with my intent when issuing commands, so I also use the -Format
parameter that indicates if you expect to export an OVF or OVA.
So, to export a single VM as a folder of files with a referential OVF file, use the following format:
Export-VApp -Destination 'C:\some_path\VM_NAME_export\' -VM VM_NAME -Format Ovf
And to export the VM as a single OVA file:
Export-VApp -Destination 'C:\some_path\VM_NAME.ova' -VM VM_NAME -Format Ova
Most of this was gleaned from the PowerCLI reference documentation at https://code.vmware.com/web/tool/vmware-powercli