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