Using New-VIProperty to get VM Tools Version
Alan Renouf has a new blog post up that takes advantage of the New-VIProperty cmdlet to add the VMware tools version to the get-vm cmdlet. you may recall that Luc Dekens had a rather extensive post a while back that talked about many cool things you could do using the New-VIProperty cmdlet.
Here’s Alan’s use case…
If we look at the object which gets returned back when we use the Get-VM cmdlet you will see […] 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
It looks like Alan’s use case looks like it may already be covered, but I figured I would post the information anyway.
6 months ago - link

