use VMware\Vim\VirtualMachine; $vm = new VirtualMachine($vim, $vmId); $name = $vm->getConfig()->getname(); echo "Virtual machine name is: " . $name;
use VMware\Vim\VirtualMachine; $vm = new VirtualMachine($vim, $vmId); $memory = $vm->getConfig()->getHardware()->getMemoryMB(); echo "Virtual machine memory size is: " . $memory . "MB";This example uses the `getHardware()->getMemoryMB()` method to retrieve the memory size of the virtual machine. The `VmConfig` class is part of the `VMware\Vim` package library, which is used for interacting with VMware vSphere APIs.