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

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

Parameters

Required Parameter Name Type Position Features Description
required
ContentLibrary
LocalContentLibrary named
  • wildcards
  • pipeline
  • 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
    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.

    -ContentLibrary  <LocalContentLibrary>
    -FileName  <String>
    -Name  <String>
    -Uri  <String>
    [-ItemType  <String>]
    [-Notes  <String>]
    [-Server  <VIServer[]>]
    [-SslThumbprint  <String>]
    [CommonParameters]

    Parameters

    Required Parameter Name Type Position Features Description
    required
    ContentLibrary
    LocalContentLibrary named
  • wildcards
  • pipeline
  • Specifies a local content library that hosts the content library item.
    required
    FileName
    String named Specifies a file name 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 the URI of the file that you want to pull into 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.

    Output

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

    Examples


    Example 1

    PS C:\> $files = Get-ChildItem -File
    PS C:\> $localContentLibrary = Get-ContentLibrary -name 'Local content library' -Local
    PS C:\> 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

    PS C:\> $files = Get-ChildItem -Name '*.ps1' -File
    PS C:\> $localContentLibrary = Get-ContentLibrary -Name 'Local content library' -Local
    PS C:\> 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.

    Related Commands

    Feedback

    Was this page helpful?