VMware Cloud Community
pauljawood
Enthusiast
Enthusiast

ESXi licencing

Hi All,

I'm looking for a way to add license’s to a VC and then applying these to the ESXi hosts in the environment. I do not think that a cmdlet has been created for this (not in the previous release) and would like to know how others have got around this.

It would be great to be able load all the license information from csv file to the VC in one script and then run another script that would check all hosts and see if it is licensed. If the host is not licensed then to apply a licence to the host.

All help will be gratefully taken.

If you found this helpful then please leave some points.
Tags (3)
0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership

I only have part of the solution. The next code adds a license to a host:

$VMHost = Get-VMHost -Name "ESX1"
$LicenseName = 'vSphere 4 Enterprise Plus'
$targethostMoRef = $VMHost.ExtensionData.MoRef
$si = Get-View ServiceInstance
$LicManRef = $si.Content.LicenseManager
$LicManView = Get-View $LicManRef
$esxLicense = $LicManView.Licenses | Where-Object {$_.Name -eq $LicenseName}
$licassman = Get-View $LicManView.LicenseAssignmentManager
$licassman.UpdateAssignedLicense($targethostMoRef.value,$esxLicense.LicenseKey,$esxLicense.Name)


Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos