Wednesday Tidbit: List VMs and their VMware Tools versions

20150713 - PowerCLII 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s