Have you tried using EditionKey instead of TypeID? When querying the installed licenses I don't see a TypeID property but I do see EditionKey that is different between ESXi and vCenter licenses. The vCenter edition key is "vc.standard.instance"
I tried that but EditionKey is not a valid property for the LicenseKeyEntry object.
PS C:\temp> $licenseKeyEntry.EditionKey = "vc.standard.instance"
The property 'EditionKey' cannot be found on this object. Verify that the property exists and can be set.
At line:1 char:1
+ $licenseKeyEntry.EditionKey = "vc.standard.instance"
+ CategoryInfo : InvalidOperation: (:) , RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
Have a look at the posting by Brian Graf over at Adding License Keys to vCenter with PowerCLI | Brian Graf's Virtualization Blog
I've cut out the code below which works in our lab environment in PowerCLI 6...
# Assumes you're already connected to the vCenter server where the license should be added
$LicKey = "xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"
$LicMgr = Get-View $VcLicMgr
$AddLic= Get-View $LicMgr.Content.LicenseManager
Yeah, read that article and that part works perfectly. But that just adds the license to the pool of licenses but doesn't actually assign it to the vCenter server. I can see the license but haven't been able to associate it with vCenter. The usage counter remains 0 for that license. As mentioned above, I tried assigning the license to the vCenter instance referenced by its UUID:
$vCenterLicenseAssignmentManager.UpdateAssignedLicense($vCenterUuid, $vCenterLicenseKey, $vCenterDisplayName)
But that did not work as the UpdateAssignedLicense method has been removed from the License Assignment Manager. So I tried exploring the bulk assignment route but am stuck on the TypeID which I cannot find a reference for as to what the valid TypeIDs are. The only example that I have been able to find references a license for vSphere servers.
Gotcha, understand what you're chasing now. Can you get anything from Onyx to see what the web client is doing when it does the license assignment, or is it just all "private API" flagged stuff?
Didn't know about Onyx so I spent some time trying to get that working. Unfortunately it breaks vCenter's web client. Supposedly the requirement is vSphere Web Client Version 6.0.0 Build 2559277. But I can only download later versions from the VMware site. (Even 6.0.0b is a higher version than what is required.)
Anyone have a working installation of Onyx on vCenter 6 and could capture the PowerCLI for assigning a vCenter 6 license to an asset?
I did not manage to find a solution neither.
However it seems directly linked to:
Deprecated. As of vSphere API 6.0 use cis.license.management.SystemManagementService
This is probably linked to the move of the “licensing service” to the platform service controller introduced with vSphere 6.0
I have looked for more information regarding cis.license.management.SystemManagementService without any success.
Consequently, i have opened a case with VMware to ask for some clarification, and how we can access via API this “cis.license.management.SystemManagementService”
When I will get an answer from VMware support I will post it here
I managed to assign a new license to a vCenter 6.0 with the API method "UpdateAssignedLicense" even if it is deprecated.
$vCenter6License = "Replace by a valid vCenter 6 License"
$MyVC = connect-viserver "YourVC"
$LicenseManager = get-view ($MyVC.ExtensionData.content.LicenseManager)
$LicenseAssignmentManager = get-view ($LicenseManager.licenseAssignmentManager)
vCenter Appliance Version 6.0 Build 2559267
PowerCLI 6.0 Release 2
Support has provided me some information regarding “cis.license.management.SystemManagementService”
but I will wait to have more details before posting the result.
They have also mentioned this:
Customer can still use the old LicenseAssignmentManager methods (which are documented as deprecated in API reference guide).
This is why I gave a try to the "UpdateAssignedLicense".
Note the URL in the previous link i have provided was wrong. This is the correct one:
Thank you for investigating this a bit further. I had opened up a ticket with VMware myself but due to a missing SDK support entitlement they were not able to assist me with this.
I can see that your example varies a little bit from what I tried before. I did not actually see the UpdateAssignedLicense method when doing my testing, but I did not use Get-View to create the $LicenseAssignmentManager object which I think is what might have done the trick.
In either case this solved my issue of not being able to license vCenter.
I would very much love to get more data on the “cis.license.management.SystemManagementService” method of managing licenses as that seems to be the way to go in the future. But for now this works for me and I have marked your response as the answer. Thank you very much again.
Answer from VMware support
[Customer] Are the following API "CIS API for 2016" public and documented?
Or as the name suggest, they will be available in 2016 ?
[VMware]The mentioned API is not yet made public or documented. For the moment you can assure the customer that they can continue using the old one, since it will be there for at least two major releases.