I recently upgraded a customer’s vCenter to 5.5 along with the ESXi hosts from 5.0 to 5.5. After the work was complete, I needed to work out which virtual machines needed their VMware Tools upgrading, as while they were all out of date… some were more out of date than others.
With eighty VMs in the cluster, manual checking was out of the question. Again PowerCLI came to the rescue.
Connect to the vCenter:
$vc = "yourvcenter.company.local"
$credential = Get-Credential
Connect-VIServer -Server $vc -Credential $credential
Use the following code to list the VMs and the tools version number:
Get-VM | where {$_.powerstate -ne "PoweredOff" } | where {$_.Guest.ToolsVersionStatus -ne "guestToolsCurrent"} | % { get-view $_.id } | select Name, @{ Name="ToolsVersion"; Expression={$_.config.tools.toolsVersion}}, @{ Name="ToolStatus"; Expression={$_.Guest.ToolsVersionStatus}}
guestToolsIsUnmanaged means tools are either not installed or are “3rd-party/Independant”
Finally, disconnect from the vCenter:
Disconnect-VIServer $vc -confirm:$false
52.370216
4.895168