Managing Licenses with LicenseManager
When you want perform tasks in the vSphere environment, you must have licenses to do so. Licensing applies to ESXi hosts, vCenter Server, and special features such as VMware HA or VMware vMotion.
The vSphere Datacenter Administration Guide explains how to manage ESXi and vCenter Server licenses using the vSphere Client, and gives background information about license keys, license inventory, and related topics.
You can also manage licenses using the LicenseManager and LicenseAssignmentManager managed objects. You use LicenseManager to explicitly manage the pool of available licenses on ESXi systems released before vSphere 4.0. You use LicenseAssignmentManager, available through the LicenseManager.licenseAssignmentManager property, to manage assignment of licenses to entities in the vCenter Server inventory. You can retrieve information, add licenses, and remove licenses.
Retrieve Information
Retrieve the LicenseManager.evaluation and LicenseManager.licenses properties to obtain information on evaluation licenses and full licenses.
Call LicenseManager.DecodeLicense to decode license information. The call returns a LicenseManagerLicenseInfo data object, which encapsulates information about the license.
Call LicenseAssignmentManager.QueryAssignedLicenses for information about assigned licenses.
Add Licenses
Call LicenseManager.AddLicense, passing in a license key, to add a license to the inventory of available licenses.
Call LicenseAssignmentManager.UpdateAssignedLicense, passing in a license key, to update the licenses for an entity, for example, a host system.
Remove Licenses
Call LicenseAssignmentManager.RemoveAssignedLicense to remove all licenses from an entity, passing in an entity to remove licenses from. You can then assign those licenses to other entities.
Call LicenseManager.RemoveLicense, passing in a license key, to remove a license from the inventory of available licenses.