You can create a content library and content library item by using the vSphere Automation SDK for PowerShell.
Prerequisites
Verify that you are connected to a vSphere Automation API server.
Procedure
-
Specify a datastore for storage
backing.
$backingDatastore = Invoke-ListDatastore -Names 'local-0'
-
Create a content library.
$storageBacking = Initialize-LibraryStorageBacking -DatastoreId $backingDatastore.datastore -Type 'DATASTORE'
$libraryModel = Initialize-LibraryModel -Name 'TestLocalContentLibrary' -StorageBackings $storageBacking
$contentLibraryId = Invoke-CreateContentLocalLibrary -LibraryModel $libraryModel
-
Create a content library
item.
$libraryItemModel = Initialize-LibraryItemModel -Name 'TestContentLibraryItem' -LibraryId $contentLibraryId
$libraryItemId = Invoke-CreateContentLibraryItem -LibraryItemModel $libraryItemModel