Update VMware Tools Automatically

Oh, VMware released a critical patch or new vSphere version, you need to upgrade your environment. Your environment is upgraded but VMware recommended that keep VMware Tools updated on your virtual machines, so you have to update.

How do you update VMware tools? Using vSphere client, PowerCLI or … .

Best way is enable a settings in virtual machine settings, “Check and upgrade Tools during power cycling”. But you need to check it on every VM.

You can use this script for enable that on all Windows virtual machines in vCenter.

Get-VM | Get-View | ForEach-Object{
    Write-Output $_.name
    if ($_.config.tools.toolsUpgradePolicy -ne “upgradeAtPowerCycle” -and $_.Guest.GuestFamily -match “windowsGuest”){
        $vm = Get-VM -Name $_.name
        $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
        $spec.changeVersion = $vm.ExtensionData.Config.ChangeVersion
        $spec.tools = New-Object VMware.Vim.ToolsConfigInfo
        $spec.tools.toolsUpgradePolicy = “upgradeAtPowerCycle”
        $_this = Get-View -Id $vm.Id 
        Write-Output “Completed”

Davoud Teimouri

Davoud Teimouri is as a professional blogger, vExpert 2015/2016/2017/2018/2019, VCA, MCITP. This blog is started with simple posts and now, it has large following readers.

1 Response

  1. 21/08/2019

    […] Update VMware Tools Automatically […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newsletter and join other subscribers

Holler Box