[vbox-dev] VM state change

ravikanth at ravichaganti.com ravikanth at ravichaganti.com
Fri Mar 5 02:19:14 PST 2010


Hi,

I am new to VirtualBox and exploring the COM interfaces to see how I can
manage vBox VM from PowerShell cmdline. So far, I am able to CreateVM,
RegisterVM, UnregisterVM and List virtual machines. Also, I could open a
remote session using OpenRemoteSession. However, I would like to be able
to change the state of VM without opening a remote session. Using
openRemoteSession brings up the console window and I do not want to do that.

Here is a set of commands I am currently running
#Initialize COM
$vBox = New-Object -ComObject VirtualBox.VirtualBox
$vBoxSession = New-Object -ComObject VirtualBox.Session

#Get VM1 in to $vm
$vm = $vBox.Machines[0]

#Open a remote session
$vBox.OpenRemoteSession($vBoxSession,$vm.Id,"gui",$null)

I can use now use the "$vBoxSession.Console" (PowerDown, etc) to change
the PowerState. Is there a way I can just Power on/off, Pause and resume a
virtual machine in the remote session (GUI) without opening the console?

Thanks for your time,
Ravi

PS: I am aware of vBoxManage.exe but my idea of creating a PowerShell
library is to make it easy to manage VB guests over PowerShell remoting
channel.





More information about the vbox-dev mailing list