PowerCLI – Get VMware-Tools versions
Imagine this:
You are sitting in your cube on a Tuesday morning and your boss walks in and says: “I need all of the installed versions of VMware-Tools to report for compliance!” Your initially reaction is probably: “really?” And then you say, OK, I can do that.
And here is how to do it:
# Add in the VI Toolkit goodness
if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSsnapin VMware.VimAutomation.Core
}
# Connect to the vCenter server(s)
$vcserver= @()
$vcserver += connect-VIServer "<Your vCenter Server>"
# get the vmware tools version for each VM
get-vm |% { get-view $_.id } | select Name, @{ Name="ToolsVersion"; Expression={$_.config.tools.toolsVersion}}
# Disconnect from the vCenter server(s)
disconnect-viserver $vcserver -Confirm:$False
# END
###
Your output will be of the form:
server1.example.com 200000
server2.example.com 0
etc.
Update (3/25/2011): My colleagues found a post on the VMTN page that has to do with my script. LucD had another idea on how to run the script that would generate so much load on vCenter. Check it out here.

Hello,
The get-vm is not needed in the script, simply used this command :
Get-View -ViewType VirtualMachine | select Name, @{ Name=”ToolsVersion”; Expression={$_.config.tools.toolsVersion}}
It will be faster
My code snippet was actually embedded in a loop to only walk through certain clusters, so I don’t believe get-view would have worked in my original use-case. I could be wrong though. However, if you are trying to walk through all VM’s in vCenter, I do believe your snippet would indeed beat mine in speed!
Good to note. Thanks!
PD
[...] check out this helpful blog post which also references a follow-up VMware community post: http://philthevirtualizer.com/2010/06/22/powercli-get-vmware-tools-versions/ [...]