tags:

views:

99

answers:

1
+1  Q: 

Python Virtualbox

how to list the names of available virtual machines in a virtualbox using pyvb modules. pls help.

+3  A: 

A good resource to learn VBox Python API is read the implementation of vboxweb

For your specific question, you can take a look at line 289 of VBoxWebSrv.py to see how virtual machines are populated.

In a nut shell, the code could be like below:

import vboxapi 
virtualBoxManager = vboxapi.VirtualBoxManager(None, None) 
vbox = virtualBoxManager.vbox
vboxVMList=virtualBoxManager.getArray(vbox, 'machines') 
Findekano
tested this code on my machine and it worked perfectly (ubuntu 9.10 x64 - VirtualBox 3.0.12)
Jiaaro