VMware Cloud Community
zenivox
Hot Shot
Hot Shot
Jump to solution

Deploy VM from Content Library fails

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

 

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

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

Reply
0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

many thanks!

Reply
0 Kudos