Automation

 View Only
  • 1.  VM Deployment using VM template in Content Library

    Posted Aug 09, 2024 10:41 AM
    I am trying to deploy VMs using following script. Getting an error "A specified parameter was not correct: Specified library item is not an OVF"
     
    $vmname = "win-2022-db-clinic1"
    $ResourcePool = "DB Cluster1 Low"
    $contentLibraryItem = "Windows22-database" #Name of VM template from the output of "Get-ContentLibraryItem" 
    $datastore = "PowerMax_DB"
    New-VM -Name $vmname -ResourcePool $ResourcePool -ContentLibraryItem $contentLibraryItem -Datastore $datastore
     
    Advise me!



  • 2.  RE: VM Deployment using VM template in Content Library

    Posted Aug 09, 2024 10:45 AM

    Instead of the Name use the object returned by Get-ContentLibraryItem on the ContentLibraryItem parameter



    ------------------------------


    Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference


    ------------------------------



  • 3.  RE: VM Deployment using VM template in Content Library

    Posted Aug 09, 2024 02:49 PM

    LucD, I think I am using the same . Here the output of Get-ContentLibraryItem. Still am I missing something ? 

    PS C:\WINDOWS\system32> Get-ContentLibraryItem
     
    Name                               ContentLibrary                 ItemType                       SizeGB         
    ----                                       --------------                   --------                                  ------         
    Windows22-app                QTS Content Library            vm-template                    31.864         
    Windows22-database       QTS Content Library            vm-template                    32.397         
    Windows19-app                 QTS Content Library            vm-template                    29.003         
    Windows19-database        QTS Content Library            vm-template                    31.992   



  • 4.  RE: VM Deployment using VM template in Content Library

    Posted Aug 09, 2024 02:54 PM

    I mean like this

    $vmname = 'win-2022-db-clinic1'
    $ResourcePool = 'DB Cluster1 Low'
    $contentLibraryItem = Get-ContentLibraryItem -Name 'Windows22-database'
    $datastore = 'PowerMax_DB'
    
    New-VM -Name $vmname -ResourcePool $ResourcePool -ContentLibraryItem $contentLibraryItem -Datastore $datastore
    


    ------------------------------


    Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference


    ------------------------------



  • 5.  RE: VM Deployment using VM template in Content Library

    Posted Aug 10, 2024 03:17 AM

    I just realised that you are using a Template in a Content Library.
    Deploying a VM from such a Template is not supported by the New-VM cmdlet, it only works with an OVF (hence the error message).

    William wrote a cmdlet for this, see Automating VM Template management using Content Library in VMC



    ------------------------------


    Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference


    ------------------------------