Update VMware Tools from PowerCLI

When it comes to updates, don't overlook VMware Tools. Virtualization expert Rick Vanover shows how to update VMware Tools via PowerCLI.

For vSphere installations, the VMware Tools drivers allow virtual machines to connect to the ESX or ESXi hypervisor for optimal performance, as well as take advantage of all of the current virtual devices. Each incremental update of VMware ESXi or ESX may incur an update for the VMware Tools installation for the guest virtual machines. Keeping VMware Tools up to date can be a task that gets away from you quickly.

One fast and repeatable way to update VMware Tools is to use PowerCLI, VMware's PowerShell implementation. A number of commands (Cmdlets) are available to make quick work of this task; for instance, the Update-Tools Cmdlet in PowerCLI allows a guest to receive an update to VMware Tools.

To utilize this Cmdlet, we'll take an example of the DROBO-WS2K8R2-SQL2K8 virtual machine with an out of date VMware Tools installation (Figure A). Figure A

Click the image to enlarge.

The following PowerCLI string will update VMware Tools on the virtual machine in question:

Update-Tools -NoReboot -VM DROBO-WS2K8R2-SQL2K8 -Server VC4.RWVDEV.INTRA
In this example, the VM is specified, as well as the vCenter Server (VC4.RWVDEV.INTRA). When the command is processed, it is displayed in the vSphere Client (Figure B). Figure B

Click the image to enlarge.

Note that the -NoReboot option was specified during this iteration of the Cmdlet and is new to the PowerCLI implementation that came with vSphere 4.1. While it will not reboot the virtual machine, there will be an impact to the Windows guest operating system. A VMware Tools upgrade will in most situations update the driver for the network interface within the virtual machine; this will cause a momentary loss of network connectivity of the guest virtual machine that is self-recoverable yet noticeable. Keep this in mind when using the script.

If you need to update multiple virtual machines, several options can be selected. The most easy to execute would be the wildcard in the -VM value. A line for each virtual machine could also be done to deliver explicit implementations.

Do you use the Update-Tools Cmdlet often? If so, do you automate it in any way? Let us know in the discussion.