You can deploy a virtual machine from a content library template.

Note: VMware PowerCLI cannot distinguish between OVF content library items of type virtual machine template and vApp template. As a result, New-VM creates a vApp if you specify a vApp template from the content library by using the ContentLibraryItem parameter of the cmdlet. If this happens, New-VM returns an error, notifying that the cmdlet produced an inventory item of the wrong type. Avoid creating vApps by using the New-VM cmdlet, as this behavior will be deprecated in future releases.

Prerequisites

  • Verify that you are connected to a vCenter Server system.

  • Verify that you have a content library with virtual machine templates available.

Procedure

  1. Get the virtual machine host.
    $myVMHost = Get-VMHost myVMHost
  2. Create the MyVM virtual machine from the MyVMContentLibrayItemName content library item.
    Get-ContentLibraryItemName MyVMContentLibrayItemName | New-VMName MyVM –VMHost $myVMHost