Guest

Discovering VMs with Specific VMware Tools Versions

A recent knowledge base (KB) article was released regarding an issue impacting a specific version of VMware Tools. The KB in question is 57796, which describes the possibility of a guest level network connectivity issues or even a purple diagnostic screen (PSOD).

Before getting to the discovery process, I want to cover some of the specifics for this KB. I do this because we’re going to need to be aware of these as we build out our one-liners and the subsequent reporting script.

The issue in the KB may be found when combined with the following:

  • VMware Tools version 10.3.0
  • ESXi 6.5 Hosts
  • VM Hardware 13
  • Windows Server 2012 or newer -OR- Windows 8 or newer

Now that we know what we’re looking for, lets cover some methods we’ll be using to make this easier.

Properties, Hash Tables, and More

Since we’re going to be focused on VMs, we’ll be making use of the Get-VM cmdlet. However, the information we need isn’t available as part of the cmdlet’s default response. We’ll need to choose specific VM properties to display.

Discovering those properties can be done in a couple different ways. If we just want to find out what properties are available and how they’re defined, we can use the Get-Member cmdlet. If we want to find out the values for all of those properties, we can use the Format-Table cmdlet. Both of these cmdlets can be used in the same way, by using the Get-VM cmdlet and passing the output to the desired cmdlet with a pipeline.

Example Code:
Show Properties for Virtual Machine Objects

In this case we’re going to be referencing the ‘Name’ property and an additional property which is available as part of the listed ‘Guest’ property, which is actually defined as an object. The property we’re looking for in the Guest object is named ‘ToolsVersion’.

We can output these specific properties using the Select-Object cmdlet. In order to properly display the ‘ToolsVersion’ property, we’ll be using a hash table to create a calculated property. The hash table is created with an ampersand and curly brackets. We can establish the calculated property with ‘name’ and ‘expression’ values.

Listing VMs and their VM Tools Versions

First things first, let’s figure out how to display our VMs’ names and their VM Tools version using the Select-Object cmdlet and a calculated property for the Tools Version.

Example Code:

PowerCLI - Get VMs and list Name and Tools Version

Listing VM Specific Information from the KB

In the example above, we can see there’s one particular VM which may be impacted by the KB. So, the next step is to obtain the rest of the information about each of the VMs.

We’ve already obtained the VM’s name and VMware Tools version properties. Now we need to figure out the ESXi host version, VM Hardware version, and what OS is in use.

The ESXi host version can be found using the VMHost property. This property returns the full ESXi host object. Since we’re working with the full object, we can return the ‘Version’ property by way of the calculated property method we used previously.

The VM Hardware version can be found by referencing the ‘HardwareVersion’ property.

The last property we’re interested in is the OS type. This too is available as a sub-property to ‘Guest’. There’s a couple to choose from, but for this example we’ll start with the ‘GuestFamily’ property.

Example Code:

Obtain requisite information for each VM per the KB

Listing Only Applicable VMs

For our last example, let’s take this process a step further and display only the susceptible VMs.

We’ll do this with the Where-Object cmdlet. We’ll use this cmdlet, in combination with a script block, to validate that each of those properties match those items listed in the KB.

We’ll be validating the following properties:

ToolsVersion 10.3.0
VMHostVersion 6.5.0
HardwareVersion vmx-13
GuestFamily windowsGuest

Example Code:

View only potentially impacted VMs

Summary

Knowledge Base article 57796 details a specific issue which has the potential to impact environments. We can use PowerCLI to easily poll our environment to obtain, and even isolate, the specific VMs which may be impacted.

Let us know in the comments how you’re building on what’s available here to create reports and even remediations!