6 Replies Latest reply on Jul 6, 2011 11:39 AM by DZ1

    Export a VM as an .OVF

    DZ1 Hot Shot

      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.

        • 1. Re: Export a VM as an .OVF
          LucD Guru
          vExpertCommunity WarriorsUser Moderators

          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: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          1 person found this helpful
          • 2. Re: Export a VM as an .OVF
            LucD Guru
            User ModeratorsCommunity WarriorsvExpert

            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: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
            • 3. Re: Export a VM as an .OVF
              DZ1 Hot Shot

              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.

              • 4. Re: Export a VM as an .OVF
                aevrov Enthusiast
                VMware Employees

                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

                • 5. Re: Export a VM as an .OVF
                  LucD Guru
                  vExpertUser ModeratorsCommunity Warriors

                  Didn't know that one, good to know.

                  You should update the help for the Move-VM cmdlet :-)

                  Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                  • 6. Re: Export a VM as an .OVF
                    DZ1 Hot Shot

                    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.