I received a question this week from a reader who was looking to change the VMware Tools upgrade policy for a few hundred virtual machines and wanted to know if it was possible to automate this. The answer is absolutely yes!

By default the VMware Tools upgrade policy is disabled and set to "manual" mode. If you want the vSphere platform to automatically check and upgrade VMware Tools upon a system power cycle, then you can enable it by going to Edit VM->Options->Tools->Check and upgrade Tools during power cycling.

To update this configuration, there is a property in the vSphere API called toolsUpgradePolicy which can accept two values: manual or upgradeAtPowerCycle.

Here is a vSphere SDK for Perl script updateVMToolsPolicy.pl that supports two types of operations: "list" and "update". The list operation will show you all VMs and their currently configured upgrade policy, by default they should be all manual unless you have changed it manually. The update operation will allow you to configure a list of VMs and policy you designate. This change can be done while the VM is running, you do not need to make any changes to the guestOS that is running.

Here is an example of the "list" operation:

If you want to take all the VMs that have "manual" policy and change them over to "upgradeAtPowerCycle", you can copy the output to a file and then use a find or UNIX/Linux grep command to search for entries that have the word "manual".

Here is the command you can use if you are on a UNIX/Linux system:

cat output | grep "manual" | awk -F '["|"]' '{print $2}'

Here is the command to get the first column which contains the VM display name:

cat output | grep "manual" | awk -F '["|"]' '{print $2}' > VMLIST

Lastly, you just need to take the previous command and redirect that to a file which will then be used in the "update" operation. You can also take the output and using an editor to get to the final output, use whatever you are comfortable with.

Here is an example of the commands listed above:

Now that we have the list of VMs we are interested in updating, we just need to select the policy and perform the "update" command. Here is an example:

So there you have it, you can now easily automate the the VMware Tools upgrade policy for any or all your VMs without having to edit each one manually.

16 thoughts on “Automating VMware Tools Upgrade Policy

  1. Here is the PowerCLI version to set VMTools to “UpgradeAtPowerCycle”:

    $vms = Get-VM | where {(Get-Cluster).Name -eq “CLUSTER NAME”}
    Foreach ($vm in $vms) {
    $config = New-Object VMware.Vim.VirtualMachineConfigSpec
    $config.Tools = New-Object VMware.Vim.ToolsConfigInfo
    $config.Tools.ToolsUpgradePolicy = “UpgradeAtPowerCycle”


  2. Check and upgrade Tools during power cycling feature does not work in ESXi 5.0
    In ESX/ESXi 4.1, the Check and upgrade Tools during power cycling option was available to upgrade VMware Tools when the virtual machine shut down. This feature does not work in ESXi 5. Ignore any documentation procedures related to this feature.

    Workaround: Install VMware Tools manually.

  3. Is there a way to automate Install VM Tools completely without human interaction by calling perl or java API? Now I am trying to do this but it seems the VM tools installer started but always popup a window to require clicking the “Next” button.

    • William, thanks for your reply.

      In http://pubs.vmware.com/vsphere-51/topic/com.vmware.ICbase/PDF/wssdk_prog_guide_5_1.pdf Page 130,
      UpgradeToolsTask – Performs an UPGRADE of VMware Tools. This method assumes VMware Tools has been installed and is running.

      What I need to do is automating INSTALL VM TOOLS. In order to install VM tools, I need to call the MountToolsInstaller( in Java) which does automatically start to run the VM tools installation program in the VM but this installation wizard pops up a window that requires human being click “Next” button in the VM otherwise the installation wizard just stays there forever.

      My question for you is: how can I fully automate the INSTALL VM tools operation without any human being interaction? or is it possible to do this? The ideal result would be the VM tools installed automatically in VM instead of requiring human being click the Next button in the VM.

    • If you call the MountToolsInstaller(), you can also pass in parameters for an unattended installation, you’ll have to look up the options. I recommend you do this manually via CLI and then once you have all the flags, then you can pass that into your script which will perform the installation.

      Take a look at this VMware KB which includes some silent install flags which may help http://kb.vmware.com/kb/1018377

    • Thanks, William.

      The problem here is: in java MountToolsInstaller( ManagedObjectReference) only takes one parameter, the ManagedObjectReference of VM. There is no way to pass the option string into the MountToolsInstaller() in the java program.

      • Hi,

        Were you able to install vmware tools automatically without any human being interaction.
        Can you please share steps to do so.


    • I’m sorry, you’re right, that’s only valid for Upgrade method. The best method that I can see is basically mount up the ISO and then using the Guest Operations to perform the unattended installation (as you would from guestOS but using the CLI)

  4. Thanks for the post William. I have a question
    I am seeing problem setting ¨upgradeAtPowerCycle¨ especially on database servers . A server reboot is happening right after the vmtools update and this is causing issue on SQL servers.My advice not to set this option on all VMs. Let me know if you got any other thoughts

Thanks for the comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.