Automating the VSAN HCL with PowerCLI

Recently I was contacted by a customer who needed to be able to update their VSAN Hardware Compatibility List in the VSAN Health Check but was unable to do so via the GUI as their vCenter servers did not have internet access.

This is a common setup as a lot of customers clearly do not want their Server infrastructure having a direct connection to the internet due to strict security requirements. The problem is when the vCenter server needs to update the VSAN HCL database file it requires a connection to the internet to do this. Whats more, this specific customer had several VCs and was getting quite frustrated with the warning that the HCL database had not been updated. Rather than turning this feature off the customer was looking for a way to update the HCL from a computer that had internet access – his desktop.

New in PowerCLI 6.5 (backwards compatible to previous versions) is a cmdlet that will help us achieve this… Update-VSANHCLDatabase, as you can see from the below image this can be run either grabbing the database information directly from the internet or if you add the “FilePath” parameter you can load the database locally.

So in this case its as simple as connecting to the vCenter servers in the same session… dont forget with PowerCLI you can work with multiple VCs in one session just by using Connect-VIServer for each VC in the sample PowerShell Session.  Once connected using the Update-VSANHCLDatabase cmdlet from the customers desktop will download the database via their internet connection and upload it to each of the vCenter servers.

What if we wanted to do this from an offline file? Sometimes people may want to update from a filepath and in that case you can manually download the file from the VMware website here: but we don’t do anything manually here!

The function at the bottom of this post has been written to allow you to not only download the file automatically but also look at the data in the database as well.

To download the file and store it for later use simply use it as follows:

Get-VsanHclDatabase -filepath ~/vsanhcl.json

This function can then be used to work with other scripts or can be used to check the database for certain controllers:

With a few more lines of code you can also double check your hosts for the correct controllers as seen in the below example:

The Script

The script for checking the controllers in your environment is listed below or to just use the function copy the function area into your powershell session.

One thought on “Automating the VSAN HCL with PowerCLI”

Leave a Reply