Just Another IT Blog

It's time to share some of my experiences, crazy ideas, tips and tricks !!!

Post Page Advertisement [Top]

Let’s be honest, licensing each ESXi host we place on the environment is a tedious task right, so why not automatize it ?!?
The majority of environments I’ve been working with just have a single bulk of licenses, deciding what license to choose doesn't need much thought ; )

The solution has been always there, documented at ESXi Installation Guide.

Let’s see how to set up Bulk licensing.

You will need PowerCli to execute it. 
If you are not familiar with that, I recommend to start reading PowerCli basics.

- start PowerCli;
- connect to the vCenter you will set up the licenses;

First thing is to bind license manager to a variable, so we can reference it in the future

- run: $licenseDataManager = Get-LicenseDataManager

You can assign a license to a specific Cluster or an Entirely Datacenter, that way the host will be licensed depending on where it will be added to. I’ll add it to my datacenter, so every host on this datacenter will get the same license.

- run: $hostContainer = Get-Datacenter -Name “Datacenter_name”

Now it comes the magic, create the reference for your license

- run: $licenseData = New-Object VMware.VimAutomation.License.Types.LicenseData
- run: $licenseKeyEntry = New-Object Vmware.VimAutomation.License.Types.LicenseKeyEntry
- run : $licenseKeyEntry.TypeId = "vmware-vsphere”
- run: $licenseKeyEntry.LicenseKey = "Your license goes here"

Then you associate them together

- run: $licenseData.LicenseKeys += $licenseKeyEntry

Last step is to tie up the license with the datacenter we selected above

-run: $licenseDataManager.UpdateAssociatedLicenseData($hostContainer.Uid, $licenseData)

To make sure license has been configured and tied together properly you can run:


The output should be similar to the screen bellow

Now, let's make it a try !!!

I do have an ESXi host using an evaluation license

 Just removed the host from my inventory and added it back to the Datacenter where my bulk license is set up.

As we can see it has been licensed immediately.

One thing to notice is if your host is already licensed it wont get a new one.

Bye bye boring task ; )

Bottom Ad [Post Page]