Recently I noticed a few servers did not have VMware tools installed. Needing to see how big of a problem this was, I turned to a few old standbys: RVtools and PowerCLI.
Of course, RVtools was able to provide the info relatively quickly, it was cluttered with extraneous information. I could have chosen to pair down the data by sorting and removing lines, but that seemed like work.
PowerCLI to the rescue!
Having not done this particular task in PowerCLI, the first thing to do was determine how to get the info. A couple of searches later and the VMware tools status was found in the extension data of get-vm: ExtensionData.Guest.ToolsVersionStatus
Great, now to use that data:
1 |
get-vm | where {$_.ExtensionData.Guest.ToolsVersionStatus -eq 'guestToolsNotInstalled' } | select name, guestid | ft -AutoSize |
So, a relatively simple one liner to find the VMs with no tools installed. Not being one to stop there and putting google to use once again, I found an article that suggested using New_VIProperty to make it easier to understand and use in the future.
Here is the same thing except we are using New-VIProperty to add some clarity and ease to the process:
1 2 3 |
New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine -ValueFromExtensionProperty 'Guest.ToolsVersionStatus' -Force get-vm | where ToolsVersionStatus -eq guestToolsNotInstalled | select name, guestid | ft -AutoSize |
The New-VIProperty cmdlet is very useful! While certainly not needed in the above examples, it gives us building blocks for more complex scripts. Stay tuned for more on VMware tools and PowerCLI.