Hi,
I am trying to license the vCenter Appliance v6.0 through PowerCLI, but I get the following error (99% of the time) after adding the license and connecting my ESXi hosts.
-> Manually reconnecting the hosts shows the same error.
-> After restarting vmware-vpxd service, adding the hosts works
-> Manually adding the vCenter license (through vSphere Client) without restarting vpxd works
Error:
Set-VMHost : 6/30/2015 9:58:17 AM Set-VMHost
The operation for the entity "esxhost01.lab.local" failed with the following message: "License not available to perform the operation.". The VMware vCenter Server 6 Standard license assigned to vCenter Server VMware vCenter Server has expired. Recommend updating the license.
At line:2 char:1
+ Set-VMHost -VMHost $esx -State Connected -LicenseKey $licesx
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-VMHost], NotEnoughLicenses
+ FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpdates_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetVMHost
Code:
$servInst = Get-View ServiceInstance
$licMgr = Get-View $servInst.Content.licenseManager
$licAssignMgr = Get-View $licMgr.licenseAssignmentManager
$vcUuid = $servInst.Content.About.InstanceUuid
$vcDisplayName = $servInst.Content.About.Name
$licInfo = $licAssignMgr.UpdateAssignedLicense($vcUuid, $licvc,$vcDisplayName)
$ESXhosts = Get-VMhost
foreach ($esx in $ESXhosts) {
Set-VMHost -VMHost $esx -State Connected -LicenseKey $licesx
}
I have tried (in all possible combinations):
- PowerCLI 6.0 Release 1 (build 2548067)
- PowerCLI 5.5 Release 1 (build 1295336)
- vCenter Appliance 6.0 (build 2559267)
- vCenter Appliance 6.0a (build 2656759 [patched from 6.0])
Never had any issues with this using vCenter 5.5. Any Ideas?
Thanks,
Chris
From the error I would say you don't have sufficient free licenses available.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have enough licenses. Adding the hosts works when I add the licenses manually through vSphere Client or WebClient. I only get the error when I license through PowerCLI (and not restart vpxd).
The error message you posted hints that the license you are trying to apply has expired: The VMware vCenter Server 6 Standard license assigned to vCenter Server VMware vCenter Server has expired. Recommend updating the license.
Looking at your posted code, I don't see where the $licesx variable is defined. Perhaps it is undefined when you run the below set-vmhost command and that is the cause of the error?
Set-VMHost -VMHost $esx -State Connected -LicenseKey $licesx