Highlighted
Contributor
Contributor

Get-ContentLibraryItem doesn't work

Hello,

I just installed PowerCLI 6.3 Release 1, in order to get 'Get-ContentLibraryItem' cmdlet available.

After launching the console, and connect to a vCenter, I run 'Get-ContentLibraryItem' command but, nothing happens.

The console doesn't return anything and it's like stuck. I can't even stop the command by CTRL+C.

It works for the other commands with no issue (get-vm, get-vmhost, and so on).

Has anybody been able to get content library information via PowerCLi?

If anybody can help, no idea how to troubleshoot this issue.

Thanks in advance.

0 Kudos
21 Replies
Highlighted
User Moderator
User Moderator

The cmdlet seems to work for me.

Can you interact with the Content Library from the Web Client without an issue ?


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

0 Kudos
Highlighted
Contributor
Contributor

Yes, from web client I can deploy New VMs from Content Library. I already tried it and worked perfectly.

> Connect-VIServer -server myvCenter

> Get-ContentLibraryItem

_  

and nothing happens after that.

I also verified that the content is synchronized form all the libraries with the web client.

0 Kudos
Highlighted
User Moderator
User Moderator

What type of Content Library did you use ?


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

0 Kudos
Highlighted
Contributor
Contributor

vCenter Content Library of vSphere 6

0 Kudos
Highlighted
User Moderator
User Moderator

I meant a local or subscribed ContentLibrary.

And on a NFS share or on a datastore ?

I tested with local datastore based ContentLibrary, and there the cmdlet works.


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

0 Kudos
Highlighted
Contributor
Contributor

It's on a datastore.

There are four vCenters.

One is acting like a master, and the other three are subscribed to this one.

I connect to this 'master' vCenter to try to 'Get-contentlibrary item'

0 Kudos
Highlighted
User Moderator
User Moderator

Do you get that behaviour on all your PowerCLI installations ?

Can you try from a PowerCLI session on another station ?

If the problem persist, I would suggest to open a SR (and yes, PowerCLI is supported)


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

0 Kudos
Highlighted
Contributor
Contributor

So for now, I can't check only in one server Smiley Sad

I tried with an administrator user and same behavior.

0 Kudos
Highlighted
Enthusiast
Enthusiast

I'm experiencing exactly the same too. It hangs whether I specify a name or not. I can't even break out of the command, and have to close PowerShell completely. This is against a vSphere 6 Update 2 environment.

Windows 10 Build 14295 (Insider Build)

PowerShell 5.1

PowerCLI 6.3 Release 1 build 3737840

Also the same on:

Windows 10 Build 10586.318

PowerShell 5.0

PowerCLI 6.3 Release 1 build 3737840

Windows 7 SP1 x64

PowerShell 4.0

PowerCLI 6.3 Release 1 build 3737840

It's the same if I run this from PowerShell with all VMware* modules loaded, or the PowerCLI shell.

I wonder what version of Windows and PowerShell it actually does work with! It must have worked somewhere, before release to customers.

0 Kudos
Highlighted
VMware Employee
VMware Employee

Sorry you re hitting issues.

These cmdlets use the vCloud Suite API, one of the things we did in this release wad make connect-viserver also connect to that API as well but I am wondering if we have an issue here.

As a start can you please try connecting to this API manually by doing a Connect-CISServer with your username and password and seeing if it connects or gives errors? If it connects try a Get-CISService to see if results are returned from the API.

Thanks

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
0 Kudos
Highlighted
Enthusiast
Enthusiast

Thanks Alan. I connected to my vCenter server using Connect-CISServer - no warnings or errors. Something I've noticed since upgrading from 6.0 R3 to 6.1 R3 is that I'm not getting prompted to enter a username and password, as though it's connecting to an existing session (this is really useful though couldn't find mention of it in the PowerCLI changelog - also worth noting that if I specify the -Credential parameter it doesn't make a difference).

This time the Get-ContentLibraryItem cmdlet immediately returned 'You are not currently connected to any servers. Please connect first using a Connect cmdlet.'

The Get-CisService cmdlet returned a bunch of name|documentation data from the API.

0 Kudos
Highlighted
Enthusiast
Enthusiast

Unfortunately, this is still a problem, and it's not listed on the known issues for PowerCLI 6.3 R1: VMware vSphere PowerCLI 6.3 Release 1 Release Notes

0 Kudos
Highlighted
Contributor
Contributor

I can confirm that this works ONLY on subscribed libraries.. but not the master library.

I would like to be able to deploy vm's from template that are stored in the master library as well.. Seems kinda pointless if you cannot deploy from the master as well..

0 Kudos
Highlighted
Contributor
Contributor

Was this ever resolved? I've run into this same issue with PowerCli 6.5. I took the suggestion of trying to retrieve items from a subscribed library rather than the master but it has the same results.

0 Kudos
Highlighted
Community Manager
Community Manager

The Get-ContentLibraryItem cmdlet does work for both local and subscriber libraries, I've recently verified this with latest vSphere 6.5d release and PowerCLI 6.5.1. The part that I was missing which I think was also assumed initially is that rather than connecting to the CIS endpoint (Connect-CisServer), you simply just need to use Connect-VIServer, behind the scenes, the cmdlet will connect to CIS endpoint to access the Content Library API.

It looks like this is the only Content Library cmdlet that exists OOTB, so I recently created a few more Content Library functions using the APIs which you can find here  http://www.virtuallyghetto.com/2017/07/vsphere-content-library-powercli-community-module.html

0 Kudos
Highlighted
Contributor
Contributor

I appreciate the response, however this is still an issue with me.  I recently upgraded to PowerCLI 6.5 R1 and this is still not working for me. I use the connect-viserver cmdlet to connect to the server. If I just do a simple "Get-ContentLibraryItem" I get nothing, it just sits there in a "stuck" state and I have to exit out of powershell.  I have tried this in both Windows ISE poweshell with the new powercli 6.5 R1 installed from the gallery as well as VMWare's PowerCLI with the same results.  It happens no matter if I'm connecting to a Published or Subscribed Library.  I tried what a user above had stated by using the "Connect-CisServer" and running the command and I get the same error as the other user where it states it is not connected to any servers.  Any ideas out there?  Should I call this into support?

0 Kudos
Highlighted
Contributor
Contributor

Connect-VIServer -Server VC1 -User administrator@vsphere.local -Password **password    

Connect-CisServer -Server vc1 -User administrator@vsphere.local -Password **Password**

0 Kudos
Highlighted
Contributor
Contributor

Connect-VIServer -Server VC1 -User administrator@vsphere.local -Password **password   

Connect-CisServer -Server vc1 -User administrator@vsphere.local -Password **Password@123

0 Kudos
Highlighted
Contributor
Contributor

Are there any other ideas from this?  I tried passing the administrator@vsphere.local info as mentioned above as well as using both the connect-viserver and connect-cisserver commandlets and I have the same results.  We have 3 different vcenters at 6.0, one with a vcsa at 6.5, and a test vcenter and this commandlet doesn't work in any of them. I was able to get this working in my home lab. Are there any port/firewall rules we may be running into that might be why I can't get this to function at work?

0 Kudos