VMware Cloud Community
DZ1
Hot Shot
Hot Shot
Jump to solution

Export a VM as an .OVF

I want to create a script that will automatically export a VM in vSphere 4 to an .OVF file.  I have been searching through the commads and I see a command for Export-VApp, but since the VMs are not virtually appliances I don't know if I can use that command.  I have tried using "help *ovf*", but that only brings up a command to Import an OVF.

I also checked Set-VM, thinking that you could convert a VM to a VApp, similair to how you can use "-ToTemplate" to change a VM to a template, but I didn't see anything there.  If anyone has dealt with this before, please help me out.

Reply
0 Kudos
1 Solution

Accepted Solutions
aevrov
VMware Employee
VMware Employee
Jump to solution

Actually, it is not hard to move a VM inside a VApp. Here's how:

Get-VM vm_name | Move-VM -Destination vapp_name

After that, you can export the VApp. Hope this helps..

Regards,

- Angel

View solution in original post

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

Afaik there is no PowerCLI cmdlet to do this, but have a look at the ovftool, which you can call from within a PowerShell script.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

LucD
Leadership
Leadership
Jump to solution

To further clarify, you can export a vApp to an OVF file like this

Get-vApp -Name MyvApp | Export-vApp -Destination "C:\Folder"

But getting your VM inside a  vApp with PowerCLI is not straightforward.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
DZ1
Hot Shot
Hot Shot
Jump to solution

Thanks for the response, I downloaded and installed the tool, I'm looking online to see how to use it.  These are ESXi boxes btw.

Reply
0 Kudos
aevrov
VMware Employee
VMware Employee
Jump to solution

Actually, it is not hard to move a VM inside a VApp. Here's how:

Get-VM vm_name | Move-VM -Destination vapp_name

After that, you can export the VApp. Hope this helps..

Regards,

- Angel

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Didn't know that one, good to know.

You should update the help for the Move-VM cmdlet 🙂


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
DZ1
Hot Shot
Hot Shot
Jump to solution

Thanks, I appreciate the help.  Unfortunately we don't have a DRS license in the environment in which I need to export, so I can't even create a vApp.  The manual way of exporting a VM as a .OVF seems so easy, you would think there would be a cmdlet for it.  Maybe on the next version or update.  Thanks for the help.

Reply
0 Kudos