You can use the vSphere Web Client or ESXi Shell to specify individual license keys, or you can set up bulk licensing by using PowerCLI cmdlets. Bulk licensing works for all ESXi hosts, but is especially useful for hosts provisioned with vSphere Auto Deploy.

Assigning license keys through the vSphere Web Client and assigning licensing by using PowerCLI cmdlets function differently.

Assign license keys with the vSphere Web Client
You can assign license keys to a host when you add the host to the vCenter Server system or when the host is managed by a vCenter Server system.
Assign license keys with LicenseDataManager PowerCLI
You can specify a set of license keys to be added to a set of hosts. The license keys are added to the vCenter Server database. Each time a host is added to the vCenter Server system or reconnects to it, the host is assigned a license key. A license key that is assigned through PowerCLI is treated as a default license key. When an unlicensed host is added or reconnected, it is assigned the default license key. If a host is already licensed, it keeps its license key.

The following example assigns licenses to all hosts in a data center. You can also associate licenses with hosts and clusters.

The following example is for advanced PowerCLI users who know how to use PowerShell variables.

Prerequisites

Prepare Your System for vSphere Auto Deploy.

Procedure

  1. In a PowerCLI session, connect to the vCenter Server system you want to use and bind the associated license manager to a variable.
    Connect-VIServer -Server 192.XXX.X.XX -User username -Password password
    $licenseDataManager = Get-LicenseDataManager
    
  2. Run a cmdlet that retrieves the datacenter in which the hosts for which you want to use the bulk licensing feature are located.
    $hostContainer = Get-Datacenter -Name Datacenter-X
    You can also run a cmdlet that retrieves a cluster to use bulk licensing for all hosts in a cluster, or retrieves a folder to use bulk licensing for all hosts in a folder.
  3. Create a new LicenseData object and a LicenseKeyEntry object with associated type ID and license key.
    $licenseData = New-Object VMware.VimAutomation.License.Types.LicenseData
    $licenseKeyEntry = New-Object Vmware.VimAutomation.License.Types.LicenseKeyEntry
    $licenseKeyEntry.TypeId = "vmware-vsphere”
    $licenseKeyEntry.LicenseKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
  4. Associate the LicenseKeys attribute of the LicenseData object you created in step 3 with the LicenseKeyEntry object.
    $licenseData.LicenseKeys += $licenseKeyEntry
  5. Update the license data for the data center with the LicenseData object and verify that the license is associated with the host container.
    $licenseDataManager.UpdateAssociatedLicenseData($hostContainer.Uid, $licenseData)
    $licenseDataManager.QueryAssociatedLicenseData($hostContainer.Uid)
    
  6. Provision one or more hosts with vSphere Auto Deploy and assign them to the data center or to the cluster that you assigned the license data to.
  7. You can use the vSphere Web Client to verify that the host is successfully assigned to the default license XXXXX-XXXXX-XXXXX-XXXXX-XXXXX.

Results

All hosts that you assigned to the data center are now licensed automatically.