New-ContentLibraryItem Command | Vmware PowerCLI Reference

New-ContentLibraryItem

This cmdlet creates a new content library item in the specified content library. If the Files parameter is specified, you can add the specified files to the newly created content library item.

Syntax

New-ContentLibraryItem
-ContentLibrary < LocalContentLibrary >
-Name < String >
[-DisableOvfCertificateChecks ]
[-Files < String[] > ]
[-ItemType < String > ]
[-Notes < String > ]
[-Server < VIServer[] > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
ContentLibrary LocalContentLibrary named
  • pipeline
  • wildcards
Specifies a local content library that hosts the content library item.
required
Name String named
Specifies the name of the library item. The library item names cannot be undefined or an empty string. Names do not have to be unique.
optional DisableOvfCertificateChecks SwitchParameter named
Specifies to skip all OVA/OVF certificate checks during the upload to the content library item.
optional Files String[] named
Specifies the paths to local or remote files that you want to add to the newly created content library item.
optional ItemType String named
Specifies the type of the library item.
optional Notes String named
Specifies a human-readable description for the content library item that you want to create.
optional Server VIServer[] named
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of the Connect-VIServer cmdlet.
New-ContentLibraryItem
-ContentLibrary < LocalContentLibrary >
-Name < String >
-VM < VirtualMachine >
[-Notes < String > ]
[-Server < VIServer[] > ]
[-Template < Template > ]
[-VApp < VApp > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
ContentLibrary LocalContentLibrary named
  • pipeline
  • wildcards
Specifies a local content library that hosts the content library item.
required
Name String named
Specifies the name of the library item. The library item names cannot be undefined or an empty string. Names do not have to be unique.
required
VM VirtualMachine named
  • wildcards
Specifies a virtual machine from which to create the virtual machine or OVF template in the content library.
optional Notes String named
Specifies a human-readable description for the content library item that you want to create.
optional Server VIServer[] named
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of the Connect-VIServer cmdlet.
optional Template Template named
  • wildcards
Specifies a virtual machine template from which to create the OVF template in the content library.
optional VApp VApp named
  • wildcards
Specifies a VApp object from which to create the OVF template in the content library.
New-ContentLibraryItem
-ContentLibrary < LocalContentLibrary >
-FileName < String[] >
-Name < String >
-Uri < String[] >
[-DisableOvfCertificateChecks ]
[-ItemType < String > ]
[-Notes < String > ]
[-Server < VIServer[] > ]
[-SslThumbprint < String > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
ContentLibrary LocalContentLibrary named
  • pipeline
  • wildcards
Specifies a local content library that hosts the content library item.
required
FileName String[] named
Specifies a list of file names that you want to use for the file pulled by the content library item from the URI specified in the Uri parameter.
required
Name String named
Specifies the name of the library item. The library item names cannot be undefined or an empty string. Names do not have to be unique.
required
Uri String[] named
Specifies a list of URIs of the file that you want to pull into the content library item. Note: http://, https://, and ds:// uris are acceptable.
optional DisableOvfCertificateChecks SwitchParameter named
Specifies to skip all OVA/OVF certificate checks during the upload to the content library item.
optional ItemType String named
Specifies the type of the library item.
optional Notes String named
Specifies a human-readable description for the content library item that you want to create.
optional Server VIServer[] named
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of the Connect-VIServer cmdlet.
optional SslThumbprint String named
Specifies the SSL thumbprint of the server hosting the file specified by the URI in the Uri parameter.
New-ContentLibraryItem
[ -VM ] < VirtualMachine >
[ -Location ] < VIContainer >
-ContentLibrary < LocalContentLibrary >
-Name < String >
-VMTemplate
[-Datastore < Datastore > ]
[-InventoryLocation < FolderContainer > ]
[-Notes < String > ]
[-Server < VIServer[] > ]
[-StoragePolicy < StoragePolicy > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VM VirtualMachine 1
  • wildcards
Specifies a virtual machine from which to create the virtual machine or OVF template in the content library.
required
Location VIContainer 2
  • wildcards
Specifies a VApp, ResourcePool, VMHost, or Cluster object where you want to place the new virtual machine template.
required
ContentLibrary LocalContentLibrary named
  • pipeline
  • wildcards
Specifies a local content library that hosts the content library item.
required
Name String named
Specifies the name of the library item. The library item names cannot be undefined or an empty string. Names do not have to be unique.
required
VMTemplate SwitchParameter named
If the value is $true, a virtual machine template is created in the content library.
optional Datastore Datastore named
  • wildcards
Specifies a datastore where you want to place the new virtual machine template.
optional InventoryLocation FolderContainer named
  • wildcards
Specifies a data center or a virtual machine folder where you want to place the new virtual machine template.
optional Notes String named
Specifies a human-readable description for the content library item that you want to create.
optional Server VIServer[] named
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of the Connect-VIServer cmdlet.
optional StoragePolicy StoragePolicy named
Specifies the storage policy for the new virtual machine template in the content library.

Output

VMware.VimAutomation.ViCore.Types.V1.ContentLibrary.ContentLibraryItem

Examples

Example 1

$files = Get-ChildItem -File
$localContentLibrary = Get-ContentLibrary -name 'Local content library' -Local
New-ContentLibraryItem -ContentLibrary $localContentLibrary -name 'New item' -Files $files

Creates a content library item named 'New item' in the 'Local content library' library, containing all the files from the C: directory.

Example 2

$files = Get-ChildItem -Name '*.ps1' -File
$localContentLibrary = Get-ContentLibrary -Name 'Local content library' -Local
New-ContentLibraryItem -ContentLibrary $localContentLibrary -Name 'New item' -ItemType 'script' -Files $files

Creates a content library item named 'New item' in the 'Local content library' library, containing all PowerShell script files from the C: directory. The type of the content library item is 'script'.

Example 3

$datastore = Get-Datastore -Name 'Datastore'
$localContentLibrary = Get-ContentLibrary -Name 'Local content library' -Local
New-ContentLibraryItem -ContentLibrary $localContentLibrary -Name 'New item' -Uri ($datastore.ExtensionData.Info.Url + 'ISOs/Photon-minimal-3.0.iso') -FileName 'Photon-minimal-3.0.iso'

Creates a content library item named 'New item' in the 'Local content library' library, containing a 'Photon-minimal-3.0.iso' file from the 'Datastore' datastore.

Example 4

$vm = Get-VM -Name 'MyVM'
$resourcePool = Get-ResourcePool -Name 'MyResourcePool'
$localContentLibrary = Get-ContentLibrary -Name 'Local content library' -Local
New-ContentLibraryItem -ContentLibrary $localContentLibrary -Name 'VM template library item' -VM $vm -VMTemplate -Location $resourcePool

Creates a virtual machine template content library item named 'VM template library item' in the 'Local content library' library from the 'MyVM' virtual machine. The associated virtual machine template is placed in the 'MyResourcePool' resource pool.

Example 5

$vm = Get-VM -Name 'MyVM'
$vmhost = Get-VMHost -Name 'MyVMHost'
$vmFolder = Get-Folder -Name 'MyVMFolder'
$localContentLibrary = Get-ContentLibrary -Name 'Local content library' -Local
New-ContentLibraryItem -ContentLibrary $localContentLibrary -Name 'VM template library item' -VM $vm -VMTemplate -Location $vmhost -InventoryLocation $vmFolder

Creates a virtual machine template content library item named 'VM template library item' in the 'Local content library' library from the 'MyVM' virtual machine. The associated virtual machine template is placed on the 'MyVMHost' host and in the 'MyVMFolder' virtual machine folder.

Example 6

$template = Get-Template -Name 'MyTemplate'
$localContentLibrary = Get-ContentLibrary -Name 'Local content library' -Local
New-ContentLibraryItem -ContentLibrary $localContentLibrary -Name 'OVF template library item' -Template $template

Creates an OVF template content library item named 'OVF template library item' in the 'Local content library' library from the 'MyTemplate' virtual machine template.

Example 7

$ovaFile = Get-ChildItem -Name 'photon.ova'
$localContentLibrary = Get-ContentLibrary -Name 'Local content library' -Local
New-ContentLibraryItem -ContentLibrary $localContentLibrary -Name 'New item' -Files $ovaFile -DisableOvfCertificateChecks

Creates a content library item named 'New item' in the 'Local content library' library, containing a 'photon.ova' OVA file, and deactivate OVA/OVF certificate checks during the upload.

Related Commands

ContentLibrary

This cmdlet creates a new local or subscribed content library.

Creates a new local or subscribed content library that uses Datastore1 as a repository for its items.

This cmdlet removes the specified content libraries.

This cmdlet modifies content library's properties.

ContentLibraryItem

This cmdlet copies content library items to a local content library.

This cmdlet exports content library item's files to the local machine.

This cmdlet retrieves catalog items from the content library.

This cmdlet creates a new content library item in the specified content library.

This cmdlet removes the specified content library items.

This cmdlet modifies content library item's properties.