Hot Shot
Hot Shot

Deploy VM from Content Library fails

Jump to solution

Hello I have a problem deploying VMs from Content Library using PowerCLI. If I don't use the Content Library item it works. Here's the command:

 

Get-ContentLibraryItem -Name "TPL_WIN_2019_1120A" | Where-Object{$_.ContentLibrary -match "GV CL"} | 
        New-VM -Name $Row.Name -VMHost $vmhost -Datastore $SDatastore -Location  $SFOLDER -OSCustomizationSpec "TMP" -ErrorAction Stop

 

and attached is the error:

 

zenivox_0-1606409535474.png

 

0 Kudos
1 Solution

Accepted Solutions
Leadership
Leadership

You are using parameters from different parameter sets.
You can't use ContentLibraryItem and OSCustomizationSpec together on the New-VM cmdlet.
See the different parameter sets for the cmdlet at the top of the Help page

As a bypass use the New-VM with ContentLibraryItem to create the VM.

Then use Set-VM -OSCustomizationSpec to assign the correct customization spec.


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

View solution in original post

0 Kudos
5 Replies
Leadership
Leadership

Are you sure the Get-ContentLibraryItem cmdlet is returning a Template object?
Which PowerCLI version are you using?


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

0 Kudos
Hot Shot
Hot Shot

Hi Luc

here is what the Get-ContentLibraryItem returns:

Name                                ContentLibrary    ItemType SizeGB
----                                     --------------           --------       ------
TPL_WIN_2019_1120A    GV CL                 ovf           28.987

 

and here my powercli version

 

PowerCLI Version
----------------
VMware PowerCLI 12.1.0 build 17009493
---------------
Component Versions
---------------
VMware Common PowerCLI Component 12.1 build 16997174
VMware Cis Core PowerCLI Component PowerCLI Component 12.1 build 16997582
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 12.1 build 16997984
VMware VimAutomation Storage PowerCLI Component PowerCLI Component 12.1 build 17001270
VMware VimAutomation Vds Commands PowerCLI Component PowerCLI Component 12.1 build 17001377

0 Kudos
Hot Shot
Hot Shot

my apologies, I should have said that the Content Library in question has subscribed to another Library in the main site.

0 Kudos
Leadership
Leadership

You are using parameters from different parameter sets.
You can't use ContentLibraryItem and OSCustomizationSpec together on the New-VM cmdlet.
See the different parameter sets for the cmdlet at the top of the Help page

As a bypass use the New-VM with ContentLibraryItem to create the VM.

Then use Set-VM -OSCustomizationSpec to assign the correct customization spec.


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

View solution in original post

0 Kudos
Hot Shot
Hot Shot

many thanks!

0 Kudos