VMware Cloud Community
MattGoddard
Enthusiast
Enthusiast
Jump to solution

PowerCLI: unable to get reliable license key info with multiple vCenters in same SSO domain

To get license key info via PowerCLI, I connect to a single vCenter and run something like this (partial code):

$serviceInstance = Get-View ServiceInstance
$licenseMan = Get-View $serviceInstance.Content.LicenseManager

The license key info is then available in "$licenseMan.Licenses".

However, whenever the vCenter I'm connected to is in an SSO domain with other vCenters, "$licenseMan.Licenses" contains data from all those vCenters, not just the specific one I'm connected to. Also, as far as I can tell, there does not appear to be anything in "$licenseMan.Licenses" that shows which vCenter a license key is associated with.

(Note: It doesn't make a difference whether I use the 'Server' parameter in 'Get-View' to specify the vCenter. The behavior is the same.)

So, is there any way to force "Get-View $serviceInstance.Content.LicenseManager" to pull data only from the vCenter that PowerCLI is connected to? If not, is there maybe something I've missed in "$licenseMan.Licenses" that shows which vCenter a license key is associated with?

Version info:

  • PowerShell: 5.1
  • PowerCLI: 11.3
  • vCenter: multiple versions of 6 & 7

---

Edited to clarify that I'm connecting to only one vCenter and that the 'Server' parameter doesn't change the behavior. Also added version info.

Labels (2)
0 Kudos
1 Solution

Accepted Solutions
MattGoddard
Enthusiast
Enthusiast
Jump to solution

Ticket worked through and closed. The official result is (paraphrasing): "That's the expected behavior."

Oh well.

View solution in original post

0 Kudos
10 Replies
a_p_
Leadership
Leadership
Jump to solution

Moderator: Moved to VMware PowerCLI Discussions

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, by using the Server parameter on the Get-View cmdlets.
That way you can point to an explicit vCenter.


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

0 Kudos
MattGoddard
Enthusiast
Enthusiast
Jump to solution

Sorry, my post was somewhat ambiguous.

To be clear: if I connect via PowerCLI to one - and only one - vCenter, I get license info for all vCenters in that vCenter's SSO domain.

The behavior is the same regardless of whether I use the 'Server' parameter. For example, if I connect to two vCenters in two different SSO domains at the same time and then I use the 'Server' parameter in 'Get-View', it ignores the second vCenter (which is the expected behavior), but it still gets license info for all vCenters that share an SSO domain with the first vCenter.

It's really strange!

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Are your vCenters in enhanced linked mode?


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

0 Kudos
MattGoddard
Enthusiast
Enthusiast
Jump to solution

If by that you mean when I open the GUI, click on a vCenter and click 'Linked vCenter Server Systems', do I see any other vCenters, then yes: I see the two other vCenters that are in the same SSO domain.

(I thought being in the same SSO domain inherently meant they were in enhanced link mode. Is that not the case?)

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is correct.
The documentation seems to state "Enhanced Linked Mode lets you view and search across all linked vCenter Server systems and replicate roles, permissions, licenses, policies, and tags."
Doesn't that explain what you are seeing?


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

0 Kudos
MattGoddard
Enthusiast
Enthusiast
Jump to solution

It potentially explains it, but if that's the reason this is happening then that's a highly odd behavior, since in every other case in PowerCLI in my experience, when you're connected to one vCenter (or you're connected to multiple vCenters but you specify only one), the data returned is specific to that vCenter.

For example, if you do 'Get-VMHost -Server [vCenter]' you don't get a list of hosts for all vCenters in that SSO domain.

Ultimately, unless there's a solution/workaround, I guess this just means that PowerCLI isn't a good tool to get license info when you have linked vCenters, which is a shame.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I would suggest opening an SR to confirm this.


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

0 Kudos
MattGoddard
Enthusiast
Enthusiast
Jump to solution

Good idea - done!

I'll post the result of that here in case someone else runs into the same issue.

0 Kudos
MattGoddard
Enthusiast
Enthusiast
Jump to solution

Ticket worked through and closed. The official result is (paraphrasing): "That's the expected behavior."

Oh well.

0 Kudos