Bash – How to Detect Outdated VMware Tools in Guest OS

bashvmware-esxvmware-esxi

I'm trying to find a generic way of checking, in the guest operating system of a virtual machine, if the VMware Tools are out of date.

The best way I have found so far has been to check the output of "vmware-toolbox-cmd -v", and to compare it to the expected version number. For example:

if [ "`vmware-toolbox-cmd -v`" = "8.3.18.20074 (build-975338)" ]
then
   echo "The vmware tools are OK"
else
   echo "The vmware tools are out of date"
   ...
   ...
fi

But the version number changes with time, so I would need to update the script every time, on every virtual machine. Or maybe I could read the "expected version number" from some shared resource, with wget or curl.

Can you help me find a better way ?

Thanks

Best Answer

I don't bother checking VMware tools versions on my Linux guest virtual machines now with the frequency of updates to ESXi and vSphere.

I'm a heavy proponent of VMware Operating System Specific Packages (OSPs).

This allows me to handle VMware guest tools independently of the host and control updates/installation at the Linux package manager level. I think it's a better way because I can also get newer tools to my guest VMs in situations where the vSphere infrastructure is older (e.g. version 4.1).

For instance, in Red Hat and CentOS, I just add the following in my routine to install guest tools:

# rpm -ivh http://packages.vmware.com/tools/esx/5.1/repos/vmware-tools-repo-RHEL6-9.0.0-2.x86_64.rpm
# yum -y install vmware-tools-esx-kmods vmware-tools-esx

The result is cleaner and easier to manage than manual tools updates from the vCenter or vSphere client level.

Related Topic