IVMVirtualMachine::Memory property

The Memory property contains the quantity, in megabytes, of physical RAM in the virtual machine.

This property is read/write.

Syntax

HRESULT put_Memory(
  [in]  long megabytesOfMemory
);

HRESULT get_Memory(
  [out] long *megabytesOfMemory
);

VB
VMVirtualMachine.Memory( _
  ByRef megabytesOfMemory, _
  ByVal megabytesOfMemory _
)

Property value

The quantity, in megabytes, of physical RAM in the virtual machine.

This property value is read/write.

Error codes

Name Meaning
S_OK
The operation was successful.
E_POINTER
The megabytesOfMemory parameter is NULL.
E_INVALIDARG
The megabytesOfMemory parameter is not valid or is out of range.
VM_E_VM_UNKNOWN
The configuration is unknown.
VM_E_PREF_NOT_FOUND
The preference was not found.
DISP_E_EXCEPTION
An unexpected error has occurred.

Remarks

The amount of physical RAM in a virtual machine must be at least 4 MB. The upper limit on memory depends on the host configuration, but can be at most 3,712 MB.

You cannot set this property if the virtual machine is running or saved.

Examples

The following example displays the Memory property value of a VMVirtualMachine object.

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows Server 2003")

Wscript.Echo "VM Name: " & objVM.Name
WScript.Echo "Memory: " & objVM.Memory

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IVMVirtualMachine