Dear colleagues!
I tried the examples described in the article on the link above
http://pubs.vmware.com/vsphere-60/topic/com.vmware.powercli.ug.doc/GUID-E2EF7911-7CFD-4541-B638-DCBB5D3B5AFE.htmlCreate a Local Content Library on an Existing Datastore
However, the script execution results in an error. Search Internet resources is not suggested workarounds.
My script is:
$ContentLibrary = Get-CisService com.vmware.content.local_library
$DatastoreID = (Get-Datastore -Name "content-library").extensiondata.moref.value
$CreateSpec = $ContentLibrary.help.create.create_spec.CreateExample()
$CreateSpec.server_guid = $null
$CreateSpec.name = "test Content Library 2"
$CreateSpec.description = "A New sample Content Library from PowerCLI"
$CreateSpec.type = "LOCAL"
$CreateSpec.publish_info.persist_json_enabled = $false
$CreateSpec.publish_info.published = $false
$DatastoreID = [VMware.VimAutomation.Cis.Core.Types.V1.ID]$DatastoreID
$StorageSpec = New-Object PSObject -Property @{
datastore_id = $DatastoreID
type = "DATASTORE"
}
$CreateSpec.storage_backings.Add($StorageSpec)
$UniqueID = [guid]::NewGuid().tostring()
$ContentLibrary.create($UniqueID, $CreateSpec)
The result of the last line - ($ContentLibrary.create($UniqueID, $CreateSpec)):
A server error occurred: 'com.vmware.vapi.std.errors.internal_server_error':
Provider method implementation threw unexpected exception: null (Server error
id: 'vapi.bindings.method.impl.unexpected'). Check
$Error[0].Exception.ServerError for more details.
At line:1 char:1
+ $ContentLibrary.create($UniqueID, $CreateSpec)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], CisServerException
+ FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisServer
Exception
I would be grateful for your help in solving this problem.
With Best Regards,
AIRRA