Export to ovf powershell

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
marsu1983
Posts: 2
Joined: 21. Dec 2014, 20:04

Export to ovf powershell

Post by marsu1983 »

Hi all,

I'm making a powershell script (vbox installed on a w2012) to halt a group of VMs, export to ovf in a folder and finally start VMs backuped up.
No problem for stopping and starting, but i'm having problems for exporting in ovf file. In the API documentation i can find:

Code: Select all

Exporting VirtualBox machines into an OVF appliance involves the following steps:

    As with importing, first call IVirtualBox::createAppliance to create an empty IAppliance object.
    For each machine you would like to export, call IMachine::exportTo with the IAppliance object you just created. Each such call creates one instance of IVirtualSystemDescription inside the appliance.
    If desired, call IVirtualSystemDescription::setFinalValues for each virtual system (machine) to override the suggestions made by the IMachine::exportTo routine.
    Finally, call write with a path specification to have the OVF file written.
Does someone already did it in powershell and tell me how ?

Many thanks for your help :)
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Export to ovf powershell

Post by mpack »

marsu1983 wrote:export to ovf...
Why? Are you planning to run them in VMware? Why not just take the obvious step of copying the VM folder?
marsu1983
Posts: 2
Joined: 21. Dec 2014, 20:04

Re: Export to ovf powershell

Post by marsu1983 »

Hi,

I don't want to export to VMware for now but maybe later. I want to do this as a backup method. In case of a problem i just want to rollback. Copying the folder does'nt look pretty just making a ovf file seems better ?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Export to ovf powershell

Post by mpack »

The standard way to backup any file or folder on your host is to copy it to secondary storage. Exporting as OVF changes the data, which is not what you want from a backup.
Post Reply