Method createVM_Task(VcVirtualMachineConfigSpec config, VcResourcePool pool, VcHostSystem host)

Creates a new virtual machine in the current folder and attaches it to the specified resource pool. This operation creates a virtual machine, instead of cloning a virtual machine from an existing one.

The server does not support creating templates using this method. Instead, you should create templates by marking existing virtual machines as templates, or by cloning an existing virtual machine or template.

This operation only works if the folder's childType includes VirtualMachine. In addition to the VirtualMachine.Inventory.Create privilege, may also require any of the following privileges depending on the properties of the virtual machine bring created:

  • VirtualMachine.Config.AddExistingDisk if including a virtual disk device that refers to an existing virtual disk file (not RDM)
  • VirtualMachine.Config.AddNewDisk if including a virtual disk device that creates a new virtual disk file (not RDM)
  • VirtualMachine.Config.RawDevice if including a raw device mapping (RDM) or SCSI passthrough device
  • VirtualMachine.Config.HostUSBDevice if including a VirtualUSB device backed by a host USB device
  • VirtualMachine.Config.AdvancedConfig if setting values in ConfigSpec.extraConfig
  • VirtualMachine.Config.SwapPlacement if setting swapPlacement
  • VirtualMachine.Config.ChangeTracking if setting changed block tracking for the virtual machine's disks.
  • Datastore.AllocateSpace required on all datastores where the virtual machine and its virtual disks will be created
  • Network.Assign required on the network which is assigned to the new virtual machine that is being created




Name Type Description
config VcVirtualMachineConfigSpec The configuration of the virtual machine hardware.
pool VcResourcePool The resource pool to which the virtual machine will be attached.
host VcHostSystem The target host on which the virtual machine will run. This must specify a host that is a member of the ComputeResource indirectly specified by the pool. For a stand-alone host or a cluster with DRS, host can be omitted, and the system selects a default.