# VirtualBox on Windows Hosts | Export and Import batch automate

VirtualBox on Windows

I am planning to deploy virtual box on around 10 computers (Vista / 7), I have setup a centos vm and exported it as an appliance with the ovf and vmdk files in the same folder.

Question Regarding VM Deployments :

Assuming VBOX is installed on the desired Machines already (latest version) Exported Appliance is on a network share Can I windows batch import it into vbox from the network share - what will be the vbox command/s in windows batch I would have to use to get this done?

any suggestions or if someone has done the same any best practice or things to look out for?

Kind Regards

-

## 1 Answer

What you want to do should work using the vboxmanage import command.

Use vboxmanage --dry-run to get a list of the parameters that will be used to import the appliance, these can be over ridden by following the instructions in the output of the dry run.

Import copies the appliance files to the default hard disk storage location. You may want to change this location.

vboxmanage setproperty machinefolder drive:\path

vboxmanage setproperty hdfolder drive:\path

cd \to\the\place\where\the\appliance\lives
vboxmanage import vmfile.ovf


should import your appliance after copying it to drive:\path

The manual (such as it is) is here.

Edit:

To power on a VM use the vboxmanage startvm <vmname> command. This could be run as part of the windows startup so that the guest is running all the time.

You can pass commands to the guest from the host using the

vboxmanage guestcontrol execute ... command.

The main problem with this is that it exposes usernames and passwords you're probably better off using a statup script on the guest.

-
Hi Iain, Thanks for your brief but to the point answer - really appreciate. One another question though :-) : Q : Now, using the commands above, I should be able to import the VM , I will put these commands in a windows batch file, can I also power that VM ON (Cent OS), and is it also possible that the host system can initiate a script inside the VM ? I can always set a startup script inside centos at first boot or something but is it possible to pass a command via windows batch or someother script inside the vm ? Will look forward to your reply Thanks so much –  rihatum Sep 28 '10 at 9:09
Thanks so much Iain, I will be testing this later this week and will update you here - thanks so much !! –  rihatum Sep 28 '10 at 11:51