Notes of a scripter

Using PowerCLI to Update ESXi License

At my office we recently upgraded our Disaster Recovery site to vSphere 7. With such, we had to upgrade our licenses from 6 to 7 for the ESXi. After importing the new license was the laborious job of updating the key on the hosts. Granted this site isn’t nearly as large as the primary site, but I wasn’t going to update the license manually on the hosts. So I added the new license key that was generated as upgrading the license to vCenter. Now is the time to hand them out to the ESXi hosts.

After checking to see what set-vmhost can do, I found an option for configuring the LicenseKey.

So to start, I used our Management Cluster, since it just houses the VMs that my team uses so it wouldn’t affect anything Production wise if it was to go bad.

get-cluster ClusterName | get-vmhost | set-vmhost -LicenseKey XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

This command goes from host to host updating the license key. Since this was the first time that I’ve used this command, I went back and spot checked the hosts to make sure it did what I thought it was doing.

As you can see from the output above, it doesn’t seem look like anything has changed. Honestly looks like the results of a get-vmhost command. Which is why I wanted to double check the script did what was expected.

After all of the ESXi hosts were updated with the new license key, I was able to remove the old one.

-Stuart

Exit mobile version