Change values in Com object (PsVirtualBox)

I know this a simple question, but I’m not able to solve this thing. In psVirtualBox module,you can create a Com object using

 $V = Get-VirtualBox 

Or we can use $VBOX variable. Say you want to change the memory of virtual machine. You use

 $VBOX.Machines.Memory = 1500

But it’s giving a error saying that the name memory didn’t exist or can’t be changed. But there is a set property over there. I’m able to see the memory using


Could any one help me with this.

do this. $VBOX.Machines |gm and send the instructions for the methods if there are any.

Is Jeff Hicks lurking around here?

It’s possible that is a read-only property so you can’t simply assign a new value. There’s probably some COM method for changing the memory. Or I vaguely recall using the command line utility which I probably wrapped in a PowerShell function. I am amazed people still find this module useful. Perhaps I shouldn’t be so quick to let it go. :slight_smile:

Thanks Jeff, that module is a life saver for me.

The output if I ran

 $Vbox.Machines | gm 
MemorySize          Property   uint MemorySize () {get} {set} 

I clipped others. It has a set property, but if I’m using

$Vbox.Machines.MemorySize[0] = 1000 

The memory value is not changing. Can you help me?

The COM stuff doesn’t always work as you expect. I’d have to dig back into the Virtual Box SDK. Or I’d suggest simply building a tool around the command line vboxmanage.exe command line tool which you should find in C:\Program Files\Oracle\VirtualBox. The utility has parameters for modifying a VM including memory. Someone needs to overhaul this module. It would even be a good candidate to take advantage of classes in v5