PowerCLI

 View Only
  • 1.  Trying to create a Template from VM using PowerCLI

    Posted Jul 27, 2023 03:51 PM

    Hello Experts, 

    I am new to VMware environment, and We have a small setup with Free license ESXI Host.

    I uploaded some windows 2016.ISO file to datastore and created a VM. 
    Now I am trying to create a Template out of it and create a New VM with that template. And also store that template in datastore

    I am using the commands below to create a Template:

    $EXSI_HOST = ""

    $HostUsername = ""
    $HostPassword = ""
    $Datastore = ""
    $sourceVMName = ""
    $TemplateName = ""


    # Connect to the ESXi host or vCenter Server
    Connect-VIServer -Server $EXSI_HOST -User $HostUsername -Password $HostPassword

    $SourceVM = (Get-VM -Name $sourceVMName).Name
    $datacenter = (Get-Datacenter).Name
    $datastore = (Get-Datastore -Name $Datastore).Name
    $Template = New-Template -VM $SourceVM -Location $datacenter -Name $TemplateName -Datastore $datastore -Confirm:$false


    But I am unable to create the template. Getting below error:
    New-Template: 7/27/2023 9:00:04 PM New-Template The operation for the entity "Template_VM" failed with the following message: "The operation is not supported on the object."
    gopalreddy577_0-1690472908530.png

    Need some inputs on this. Even when I logged in the same in the ESXI UI

    gopalreddy577_1-1690472973904.png

     





  • 2.  RE: Trying to create a Template from VM using PowerCLI

    Posted Jul 27, 2023 04:08 PM

    Please go through the below document, hope this will help you creating Template from VM:

    https://vdc-download.vmware.com/vmwb-repository/dcr-public/73d6de02-05fd-47cb-8f73-99d1b33aea17/850c6b63-eb82-4d9c-bfcf-79279b5e5637/doc/New-Template.html

    Regards,

    Sachchidanand



  • 3.  RE: Trying to create a Template from VM using PowerCLI

    Posted Jul 28, 2023 11:54 AM

    You need a vCenter for cloning VMs this way.