Content Library Category

Cmdlets are usually implemented around resource operations. The four basic operations are CREATE, READ, UPDATE and DELETE. This set of operations is known as CRUD. Most of the cmdlets support CRUD which are respectively cmdlets that start with the New/Get/Set/Remove cmdlet verbs but they also may have additional operations.

Step 1: Retrieve a object by running a Get command 

You can READ objects by using Get-ContentLibraryItem cmdlet.

Step 2: Run commands from the CRUD group 

You can CREATE objects by using New-ContentLibraryItem cmdlet. See example below:

$files = Get-ChildItem -File
$localContentLibrary = Get-ContentLibrary -name 'Local content library' -Local
New-ContentLibraryItem -ContentLibrary $localContentLibrary -name 'New item' -Files $files
You can UPDATE objects by using Set-ContentLibraryItem cmdlet. See example below:
$files = Get-ChildItem -File
$item = Get-ContentLibraryItem -Name 'vm1'
Set-ContentLibraryItem -ContentLibraryItem $item -Name 'New name' -Files $files

You can REMOVE objects by using Remove-ContentLibraryItem cmdlet.

Step 3: Explore More Related Commands: 

Copy-ContentLibraryItem This cmdlet copies content library items to a local content library.
Export-ContentLibraryItem This cmdlet exports content library item's files to the local machine.
Get-ContentLibrary This cmdlet creates a new local or subscribed content library.
New-ContentLibrary Creates a new local or subscribed content library that uses Datastore1 as a repository for its items.
Remove-ContentLibrary This cmdlet removes the specified content libraries.
Set-ContentLibrary This cmdlet modifies content library's properties.

Was this page helpful?