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:
---
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.
Ticket worked through and closed. The official result is (paraphrasing): "That's the expected behavior."
Oh well.
Moderator: Moved to VMware PowerCLI Discussions
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
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!
Are your vCenters in enhanced linked mode?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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?)
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
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.
I would suggest opening an SR to confirm this.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Good idea - done!
I'll post the result of that here in case someone else runs into the same issue.
Ticket worked through and closed. The official result is (paraphrasing): "That's the expected behavior."
Oh well.