PowerCLI - Determine if VM Compatability (Hardware Version) is latest
I have spent entirely too much time digging through all of the data i can get returned about a VM using PowerCLI trying to find this answer so i'm really hoping someone can confirm it either is not available because it's not been exposed to the PowerCLI or that they have a solution that may work for me.
What i'm trying to do is very simple. I want to determine IF the current hardware version of a VM is the latest supported by the host it's sitting on. VMware Tools you can get a toolsCurrent or similar value back so you know that the tools are old, current, etc... I want to know the same thing for VM Hardware. I know vCenter knows whether or not an upgrade is available for a VM because if the VM is turned off and you right-click on the VM in the Web client and choose 'Compatibility', the option to 'Upgrade VM Compatibility' is not greyed out if there is an updated version. If it's already the latest, that option remains greyed out.
Does anyone know of a way, even if it's a backwards way of doing it with too many steps... to know if the current VM Version is the latest supported?
I can find all sorts of posts about how to upgrade via script but not one person seems to have asked what i'm asking haha. Any help is greatly appreciated.
Yes that will work to return the value. Returning the value is not what i'm having problems with. The problem i'm having is that there should be some way to know if that is the latest, or that there is an upgrade available, some sort of attribute that denotes that i'm not already at the latest version based on the host the VM is running on. The idea is to have my script not need to be updated based on changing versions of underlying ESX... as i would hate to have to update the script every time we upgrade one or more ESX hosts in our environment.
Basically, I don't want to assume and/or hard code a value anywhere in the script. I just can't believe there doesn't seem to be a way to determine that without maintaining a list of versions to go along with underlying ESX versions so a comparison can be made to know if the VM is the right version for the host.