Create a virtual machine by calling the Folder.CreateVM_Task method with the following arguments:

  • _this —Folder where you want to place the virtual machine.
  • configVirtualMachineConfigSpec data object that specifies CPU, memory, networking, and so on. See Specifying Virtual Machine Attributes with VirtualMachineConfigSpec)
  • pool— Resource pool for the virtual machine to draw resources from.
  • hostHostSystem managed object that represents the target host on which to run the virtual machine. If you invoke this method on a standalone host, omit this parameter. If the target host is part of a VMware DRS cluster, this parameter is optional; if no host is specified, the system selects one.
Important: All objects must be located in the same datacenter.