Creating a Virtual Machine Using VirtualMachineConfigSpec

Use the Folder.CreateVM_Task method to create a virtual machine by specifying its attributes. You must specify either a host or a resource pool (or both). The virtual machine uses the CPU and memory resources from the host or resource pool.