Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

How to Automate the Upgrade of VMware Tools and VM Compatibility

  • March 5, 2020
  • 12 min read
IT and Virtualization Consultant. Vladan is the founder, and executive editor of the ESX Virtualization Blog at vladan.fr. He is a VMware VCAP-DCA and VCAP-DCD, and has been a vExpert from 2009 to 2023.
IT and Virtualization Consultant. Vladan is the founder, and executive editor of the ESX Virtualization Blog at vladan.fr. He is a VMware VCAP-DCA and VCAP-DCD, and has been a vExpert from 2009 to 2023.


After each new version of VMware vSphere, you have to do two things. First, upgrade VMware tools in all your Virtual Machines (VMs) and upgrade the VM compatibility.

The VM compatibility is not mandatory, but as you know, every VMware vSphere release brings new features and functions, and those are usually only available for VMs configured with the latest virtual hardware. Current virtual hardware is version 16, and I assume that the next one will be version 17 in the vSphere NEXT.

If you want to benefit from the latest features of vSphere, you have to upgrade the VM hardware and its VM compatibility.

The title of this blog post lets you assume that we will try to automate if we have many VMs and we have to do a lot of repetitive upgrade tasks in order to benefit from the latest features.

However, take note that, as you can imagine, with an automated process, there is a small chance that something might not go as expected. Error or fail during the process, this can happen, but it is rather rare and usually there might be something else which is currently running inside of the VM which prevents the process to finish with success.

Usually, this is not very important as there is only a low risk. The only thing if the automated install fails is that the admin will have to re-install the VMware tools manually.

While this might happen on a couple of VMs within the environment, the majority should be just fine.

The VM which needs the new VMware tools usually looks like this.

VMware tools

Newer version of VMware tools available

The steps to follow are quite simple:

  • Open the vSphere client by connecting to your vCenter server.
  • Go to VMs and Templates > find and select your VM.
  • Do a Right-click on the VM > click Edit Settings.
  • At the top of the window, select VM Options.
  • Expand VMware Tools section and In Tools Upgrades, check the box called Check and upgrade VMWare Tools before each power on.
  • Click OK to validate.

Check and upgrade VMware Tools before each power on

Check and upgrade VMware Tools before each power on

Now you tell me, this is not an automation? True, this way we only enable the automatic upgrade of VM tools on per-VM basis.

Automation via PowerCLI

There is a couple of different ways to upgrade the VMware tools via PowerCLI. But before we jump in, I’ll show you how to setup PowerCLI via PowerShell (if you’re connected to the Internet). It takes a couple of minutes only.

Open the PowerShell window on your management machine and type in:

You might see a message that the NuGet provider is required to continue. Type “Y” to continue.

Then type in:

The output looks like this

Install PowerCLI on your management system

Install PowerCLI on your management system

Now we can connect to our vCenter server with this command:

Connect to vCenter

Connect to vCenter

If you’re getting an error of certificate, it’s because PowerCLI does not like your self-signed certificate on vCenter server. Run this command to remediate:

Now that we are connected to vCenter, we can finally check which VMs need to update their VMware tools.

Here is an example of a PowerCLI code which allows us to see which VMs we have in a particular folder (if we are organized with folders), and we can remediate those VMs to the latest version.

In our example, howeve,r we cannot show the example as our VMs are either Unmanaged or VMware tools are current.

PowerCLI to show VMs and their VM Tools status

PowerCLI to show VMs and their VM Tools status

If you, however, have some VMs which need to be upgraded, there is a PowerCLI oneliner which can do the job:

All VMs will start updating their VM tools at the same time.

Another way which can help us to mass-update VMware tools at scale is via vSphere Update Manager (VUM).

Use VMware vSphere Update Manager (VUM) for VM Tools Upgrade

We can use the vSphere Update manager and update VMware tools on many VMs at once. If you are already using VUM to patch your hosts, you are only a step away from setting a few options and updating the VMware tools in your VMs.

VUM is able to trigger updates for individual VMs based on baselines. You can use VUM to update multiple VMs, so if a new version is available, the Tools will update whenever a guest reboots.

Let’s have a look at the necessary steps.

VMware Tools and VM Hardware can be both mass-updated from within VUM. You can access VUM from the shortcuts within the vSphere web client or from as the side menu.

Here are two examples:

VM Tools Update via vSphere Update Manager

VM Tools Update via vSphere Update Manager

And for VM hardware, you have an option right next to it. Make sure to select the right cluster as you certainly have several clusters, each based on different hardware version depending on your hardware where you run ESXi.

VM Hardware Upgrade via vSphere Update Manager

VM Hardware Upgrade via vSphere Update Manager

And this is basically it. As you can see, there is also the option to “upgrade to match host” (see the arrow), allowing you to mass upgrade the VM tools immediately.

You should know that the VMs will reboot immediately after you click Upgrade to match if you have selected immediately.

Note: Keep in mind that with Windows Server 2016 and higher, the system does not need to reboot after the VMware tools installations. It’s due to a design.

First you should update the VMware tools to the latest version and then only you should upgrade the VM hardware on the VMs which you judge that they need it.

VMware actually does not recommend to systematically upgrade the VM hardware unless the VMs needs a particular feature which is not present in the previous release of that VM hardware.

Changing VM hardware to the VM is like changing a motherboard on a PC or server. The OS will be presented to different set of features and there might be some necessary adjustments to be made afterwards.

If your VMs have VM hardware version 7 at least, you’ll be fine. Version 7 has introduced Changed Block Tracking (CBT) which is necessary for incremental backups.

Final Words

PowerCLI is a very powerful option to mass-upgrade the VMware tools on many VMs at once. vSphere update manager (VUM) is another option which allows us to do so. VMware tools and VM hardware are the principal components to watch. While VMware tools have to be updated every time, the VM hardware does not.

 

Found Vladan’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!