ContentLibrary Category | Vmware PowerCLI Reference

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-ContentLibrary cmdlet. See example below:

# Retrieves all content libraries from the default connected servers.


Step 2 : Run commands from the CRUD group

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

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

New-ContentLibrary -Name 'Local Content Library' -Description 'Local content library description.' -Datastore $Datastore1 -Published
You can UPDATE objects by using Copy-ContentLibraryItem cmdlet. See example below:

# Copies a content library item named 'vm1' to the 'Local content library' content library.

$item = Get-ContentLibraryItem -Name 'vm1' $library = Get-ContentLibrary -Name 'Local content library' -Local Copy-ContentLibraryItem -ContentLibraryItem $item -Destination $library
You can REMOVE objects by using Remove-ContentLibrary cmdlet. See example below:

# Removes all content libraries whose names end in 'obsolete' from the default connected servers.

$libraries = Get-ContentLibrary -Name '*obsolete' Remove-ContentLibrary $libraries

Step 3: Explore More Related Commands:

Export-ContentLibraryItem This cmdlet exports content library item's files to the local machine.
Get-ContentLibraryItem This cmdlet retrieves catalog items from the content library.
New-ContentLibraryItem This cmdlet creates a new content library item in the specified content library.
Remove-ContentLibraryItem This cmdlet removes the specified content library items.
Set-ContentLibrary This cmdlet modifies content library's properties.
Set-ContentLibraryItem This cmdlet modifies content library item's properties.