Author Posts

August 10, 2016 at 4:26 pm

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

 $VBOX.Machines.Memory 

Could any one help me with this.

August 10, 2016 at 9:02 pm

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

Is Jeff Hicks lurking around here?

August 10, 2016 at 9:23 pm

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. 🙂

August 11, 2016 at 2:18 am

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

August 11, 2016 at 4:22 am

The output if I ran

 $Vbox.Machines | gm 

is

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?

August 11, 2016 at 2:29 pm

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