Home > Blogs > VMware PowerCLI Blog


VM Tools and Virtual Hardware Versions

Alan Renouf, Sr Technical Marketing Architect, VMware

After reading Kyle’s post on the ESXi Chronicles blog here (I didn’t know you could do that) I wanted to show how you could gather and also export the Tools and Virtual Hardware Version in PowerCLI, this also allows us to use one of my favorite cmdlets New-VIProperty, a great post on this cmdlet can be found here.

If we look at the  object which gets returned back when we use the Get-VM cmdlet you will see that there is a root property for the Name, PowerState, NumCPU and many many more, one of these is the Version, this shows the hardware version so its easy enough to grab each VM’s name and Hardware Version by using:

Get-VM | Select Name, Version

But the returned object doesn’t have a root property for ToolsVersion or ToolsVersionStatus, for this we need to delve into the ExtensionData property and have a look around, once we have found the information it is fairly easy to add these to our object using the New-VIProperty cmdlet as below:

New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine
    -ValueFromExtensionProperty 'Config.tools.ToolsVersion'

    -Force

New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine
    -ValueFromExtensionProperty 'Guest.ToolsVersionStatus'

    -Force

Now we have added these as a new property to our object (actually they are PowerShell Code Properties), we can use our old friend Get-VM to retrieve the information easily:

Get-VM | Select Name, Version, ToolsVersion, ToolsVersionStatus

image

Of course we can choose which list of VMs to get this information for:

For a Datacenter: Get-Datacenter London | Get-VM | Select Name, Version, ToolsVersion, ToolsVersionStatus

For a cluster: Get-Cluster Production | Get-VM | Select Name, Version, ToolsVersion, ToolsVersionStatus

For a host: Get-VMHost Host1.mydomain.local | Get-VM | Select Name, Version, ToolsVersion, ToolsVersionStatus

And we can also easily export this information into a csv file:

Get-VM | Select Name, Version, ToolsVersion, ToolsVersionStatus | Export-Csv -NoTypeInformation -UseCulture -Path C:\Temp\VMHWandToolsInfo.csv

This entry was posted in Extensions on by .
Alan Renouf

About Alan Renouf

Alan Renouf is a Product Line Manager at VMware focusing on API's, SDK's and CLI's, He is responsible for providing the architects and operators of private and public cloud infrastructure with the toolkits/frameworks and command-line interfaces they require to build a fully automated software-defined datacenter. Alan is a frequent blogger at http://blogs.vmware.com/PowerCLI a book author and has a personal blog at http://virtu-al.net. You can follow Alan on twitter as @alanrenouf.

16 thoughts on “VM Tools and Virtual Hardware Versions

  1. NewB

    New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine -ValueFromExtensionProperty Config.tools.ToolsVersion -Force
    New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine -ValueFromExtensionProperty Guest.ToolsVersionStatus -Force

    Reply
  2. CJH

    Is it just me, or is the new get-viproperty cmdlet broken?

    Reply
  3. Alan Renouf

    Hi NewB,
    In what way is it broken, are you receiving an error ?

    Reply
  4. Brian Whitaker

    Hello Alan,

    Thank you for taking the time to put this together, I found it to be very useful.

    Best regards,
    Brian

    Reply
  5. Maelito

    Hi Alan,
    Big fan of yours!!!!

    how do I wrap that code in a script?

    I am not the best in PS ….

    thanks, Maelito

    Reply
  6. Blasting

    This writing are all that she has feelings for in her Earth. Will you write scary writings! Blast! We fell on his techs among them to that a man need to deem which they are pretty.

    Reply
  7. Sonny Chan

    The command works great and I can identify all VM version 4 VMs and send the list to my team for upgrade. Thanks.

    Reply
  8. Nicole Faust

    Hello Alan,

    We really need to list the VMware Tools version with the BUILD version

    We recently got a patch from VMware that is a minor upgrade for the VMware Tools, so the only to find out if the Tools were updated correctly is to check the build number of the Tools… since we have more than 700 VMs, we cannot go in each VM and execute the command in Windows that gives the version and build of the Tools : VMwareToolboxCmd.exe -v gives something like : 9.4.10.38250 (Build-2092844).

    DO you know if there is another variable that would do the trick in powercli ?

    Thank you !

    Reply
  9. Trevor

    Hello Alan, is there any way to stop Windows services on vm’s and have them restart using this method?

    Reply
  10. Caleb Meadows

    Thank you!

    Reply
  11. mike irvin

    I’m running esxi6.0 and PowerCLI 6.3 Release 1.
    ToolsVersion and ToolsVersionStatus fields are blank, HW version is returned. Anyone else see this behavior?
    Command I used:
    get-vm -location “Some-folder-name” | Select Name, Version, ToolsVersion, ToolsVersionStatus

    Reply
    1. Martin Urban

      You must use before :

      New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine
      -ValueFromExtensionProperty 'Config.tools.ToolsVersion'

      -Force

      New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine
      -ValueFromExtensionProperty 'Guest.ToolsVersionStatus'

      -Force

      Reply
  12. Paul Higel

    Yes, but as he mentioned, you have to enable the properties before you can report on them.

    Reply
  13. Canon Printer Customer Service

    Canon is a leading brand in digitalization. It will provide the best printer to print your own idea with relevant features. But there are some issues were occurs while using it and it can’t resolve itself and want to some experts advice so there is Canon Printer Customer Service executive to sort your issue.

    Reply
  14. Canon Printer Customer Service

    Canon is a leading brand in digitalization. It will provide the best printer to print your own idea with relevant features. But there are some issues were occurs while using it and it can’t resolve itself and want to some experts advice so there is Canon Printer Customer Service executive to sort your issue.

    Reply
  15. Andrew Curtis

    Or if enabling the property isn’t easily done for your environment, the following should work too.

    Get-Vm $computername | select name,
    @{n=”CPUs”;e={$_.numcpu}},
    memorygb,
    @{n=”VM Tools Version”;e={$_.Extensiondata.Config.tools.ToolsVersion}},
    @{n=”VM Tools Status”;e={$_.Extensiondata.Guest.ToolsVersionStatus}}

    Reply

Leave a Reply

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

*