[vbox-dev] VM state change

ravikanth at ravichaganti.com ravikanth at ravichaganti.com
Fri Mar 5 09:43:33 PST 2010


Klaus,

I am not trying to solve a problem but trying to create a PowerShell
wrapper around VirtualBox COM. Most of what I do (and there are a bunch of
others) is automated in PowerShell and using vboxmanage.exe for automation
isn't a better way when there is a rich set of COM interfaces available.

Ravi

> ravikanth at ravichaganti.com wrote:
>> Hi Achim,
>>
>> OpenExistingConnection() works fine. However, I would like to find out
>> if
>> it is possible to power ON a VM in the GUI session without opening the
>> console. This is important for me since I am not creating a front-end. I
>> would still use the GUI as the front-end and only create/manage virtual
>> machines from the commandline.
>
> The only way to start a VM via the API is
> IVirtualBox::openRemoteSession. There are no intentions to change this.
> I think you described pretty much everything by now except the real
> problem you're trying to solve.
>
> Klaus
>
>> I have not looked at XIDL. So, I am unsure on how to autogenerate PS
>> scripts from that. I will look in to that sson.
>>
>> Thanks
>> Ravi
>>
>>> If you want to do something on an already running VM, you have to do
>> OpenExistingSession. Check the VBoxManage source code.
>>> PowerShell integration is a good idea, best would be to auto-generate
>> the
>>> integration based on our XIDL, the way we do it for all the other APIs.
>>>
>>> Achim.
>>>
>>> On Mar 5, 2010, at 11:19 , ravikanth at ravichaganti.com wrote:
>>>
>>>> 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