VMware Cloud Community
decamate
Contributor
Contributor

PowerCLi 11.5's Get-ContentLibrary cmdlets not working

Hello

My vSphere environment is finally all on 6.0, so it's become time to upgrade my PowerCLI deployment scripts to work from Content Libraries. I started delving into the process but my existing 11.2 PowerCLI had only the Get-ContentLibraryItem cmdlet native. I found the Functions William Lam posted here (PowerCLI-Example-Scripts/ContentLibrary.psm1 at master · lamw/PowerCLI-Example-Scripts · GitHub ) but that did not seem to work in my environment. No problem - I saw that PowerCLI 11.5 was available and had additional cmdlets. I upgraded my PowerCLI and none of the new cmdlets nor even the most basic Get-ContentLibrary query works anymore. The error I get back is:

Get-ContentLibrary : 12/10/2019 10:07:48 AM     Get-ContentLibrary              An error occurred while trying to get content

libraries by names. For more details check the inner exception.

At line:1 char:1

+ Get-ContentLibrary

+ ~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-ContentLibrary], CisException

    + FullyQualifiedErrorId : ViCore.Impl.V1.Service.ContentLibrary.ContentLibraryImpl.GetContentLibraryNonWildcardNam

   es.Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.ContentLibrary.GetContentLibrary

I'm connected properly via Connect-VIServer and verified connectivity through other cmdlets. Any ideas?

Thank you!

Reply
0 Kudos
11 Replies
LucD
Leadership
Leadership

Did you try also doing a Connect-CiSServer?

Are the REST API for Content working from the API Explorer?
Are you using local or subscribed ContentLibraries, or a mix?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
decamate
Contributor
Contributor

Hi LucD

I am successfully able to connect via Connect-CisServer to the vSphere server, but it makes no difference in the response to the Get-ContentLibrary cmdlets.

The content library is a local one to test with, before rolling out across our datacenters. We just upgraded the last of our hosts to v6.0 so we could not use the library function until now.

I do not know how to check the REST API - since we are on 6.0 and as far as I can tell you must be on 6.5 to use the REST API.

Thanks!

Reply
0 Kudos
LucD
Leadership
Leadership

Officially yes, but there are REST API available, especially the ContentLibrary ones.

See vSphere 6.0 REST API: A History Lesson | Niktips's Blog


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
decamate
Contributor
Contributor

Hi LucD

Following your blog example I am able to make the POST call to https://vcenter/rest/com/vmware/cis/session with my credentials and get the token. I then switch to "No auth" and used the session token POST call to https://{{vc}}/rest/com/vmware/content/library?~action=list and get a return body of:

{

    "value": [

        "28b836ef-8eac-40c4-bcaf-3066739df402"

    ]

}

This matches with the number of libraries I have, but to make sure I created a second library and repeated the POST call and now get a second library value in the JSON file.

So - the question remains why Get-ContentLibraryItem or Get-ContentLibrary from PowerCLI 11.5 fails while running Get-ContentLibraryItem works fine from 11.2 from another machine. I may remove all PowerCLI and PowerShell items and start fresh just to make sure something is not messed up on my end. I removed 11.2 rather than have both 11.2 and 11.5 exist simultaneously as was the default behavior when updating the PowerCLI module.

Thank you

Reply
0 Kudos
LucD
Leadership
Leadership

Sorry, not too sure what might be causing this issue, but it defenitely seems to be a PowerCLI issue.

Unfortunately I don't have 6.0 around to do some tests.
They did introduce a bunch of new ContentLibrary cmdlets in 11.5, that might have broken something with older vSphere versions.

If my assumption is correct, it should also still work with 11.4

I would in any case suggest to open a SR


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Govt_Matt
Contributor
Contributor

decamate​ Did you find a solution to this? I am using 11.5, and I am experiencing exact same issue.

Reply
0 Kudos
LucD
Leadership
Leadership

The latest release, PowerCLI 12.0, contains a bug fix for Get-ContentLibrary.
Perhaps you could try with thise version.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Govt_Matt
Contributor
Contributor

Still getting same issue after upgrading PowerCLI to 12.0.0:

PS C:\Windows\system32> Get-PowerCLIVersion

PowerCLI Version

----------------

   VMware PowerCLI 12.0.0 build 15947286

---------------

Component Versions

---------------

   VMware Common PowerCLI Component 12.0 build 15939652

   VMware Cis Core PowerCLI Component PowerCLI Component 12.0 build 15939657

   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 12.0 build 15939655

PS C:\Windows\system32> Get-ContentLibrary

Get-ContentLibrary : 4/16/2020 11:55:27 AM Get-ContentLibrary An error occurred while trying to get content libraries by names. For more details check the inner exception.

At line:1 char:1

+ Get-ContentLibrary

+ ~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-ContentLibrary], CisException

    + FullyQualifiedErrorId : ViCore.Impl.V1.Service.ContentLibrary.ContentLibraryImpl.GetContentLibraryNonWildcardNames.Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.ContentLibrary.GetContentLibrary

Reply
0 Kudos
LucD
Leadership
Leadership

Then I would definitely suggest to open a SR


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Govt_Matt
Contributor
Contributor

Will do, thanks LucD

Reply
0 Kudos
jburen
Expert
Expert

I am also trying to upload items to a Content Library through PowerCLI. The inner exception is : The current operation requires a server capability which is unavailable: 'Cis is not available on vCenter prior to version 6.5.'.

Consider giving Kudos if you think my response helped you in any way.
Reply
0 Kudos