VMware {code} Community
Manoj_Shingare
Contributor
Contributor
Jump to solution

Unable to change memory size of Virtual Machine?

I am unable to change memory size (RAM) of Virtual Machine,But i am able to change name of Virtual machine,

The step that I followed

ManagedObjectReference vmRef = (ManagedObjectReference)((VimApi.ManagedObjectReference[])(obj[0]))[2]; // virtual machine Reference

VirtualMachineConfigSpec vSpec = new VirtualMachineConfigSpec();

vSpec.memoryMB = 512;

vSpec.name = "Test1";

service.ReconfigVMTask(vmRef, vSpec);

Could anybody tell me, where i am getting wrong.

Thnx in advance for help.

Reply
0 Kudos
1 Solution

Accepted Solutions
njain
Expert
Expert
Jump to solution

Hi Manoj,

While working on C# samples, some properties of the objects require counterpart properties to be defined which determine that the property has been set. In your case, you need to set "memoryMBSpecified" as true to change the memory size. Add the below line in your code, and it should be working correctly:

vSpec.memoryMBSpecified = true;

Regards,

Neha

View solution in original post

Reply
0 Kudos
2 Replies
njain
Expert
Expert
Jump to solution

Hi Manoj,

While working on C# samples, some properties of the objects require counterpart properties to be defined which determine that the property has been set. In your case, you need to set "memoryMBSpecified" as true to change the memory size. Add the below line in your code, and it should be working correctly:

vSpec.memoryMBSpecified = true;

Regards,

Neha

Reply
0 Kudos
Manoj_Shingare
Contributor
Contributor
Jump to solution

Hi Neha ,

You seems to be very Helpful and Nice person.

Is there any extra help available on net , particularly for C# development.

All the programming guides have sample in JAVA.

Thanks and Regards,

Manoj V. Shingare

Nihilent Tech. Pvt. Ltd,Pune

Mobile - 9923180398

Reply
0 Kudos