Upgrade virtual machine hardware using powercli

by Grzegorz Kulikowski

Now, i know that there are some examples in internet about this but they were not working for me for some reason(still don’t know why).
UpgradeVM_Task SDK ref
So in order to upgrade vmware hardware version you have to execute method called UpgradeVM_Task from virtual machine object.
[sourcecode language=”powershell”]
$myvmid=(get-vm ‘myvm’).id
(get-view -id $myvmid).UpgradeVM_Task(‘vmx-08’)
If you want to upgrade to version 7, then you have to use ‘vmx-07’. I am running this against vsphere 5 and it works very well. Now, reading manual it says:
Regarding the ‘Version’ parameter:
“If specified, upgrade to that specified version. If not specified, upgrade to the most current virtual hardware supported on the host.”
But if you will give $null or “” , or nothing, it will just not work. I hope i will get some more information why it behaves like this.
[sourcecode language=”powershell”]
$id=(get-vm ‘myvm’).id
$vmview=get-view -id $id
$param = @($null)
This will run upgrade_VM_Task method without specifying the version string. It took me some time to figure this out 😉

ParameterType : System.String
Name : version
DefaultValue :
RawDefaultValue :
Position : 0
Attributes : None
Member : VMware.Vim.ManagedObjectReference UpgradeVM_Task(System.String) -> 1 parameter

the parameter should be an array of 1 null here
as per
Invoke(System.Object obj, System.Object[] parameters)

You may also like


Matthias Hans August 5, 2013 - 1:35 pm

Very nice! Thank you. This is what I was looking for.
One more questing: is there an option to schedule/plan the hardware upgrade to be executed at next reboot. I want to make a script that runs through all virtual machines and upgrade them without shutting down the guest right now. e.g. -NoReboot like upgrading vmware tools.
Thank you!

psvmware August 5, 2013 - 6:00 pm

hi Matthias, from what i know there is no possibility like this. You can only upgrade vmware tools when there is power cycle.
If you are doing power cycles with scripts, then you might add the vm hw upgrade into that script.

Anonymous October 15, 2013 - 1:45 am

I too was looking for a script that could schedule the upgrade, it must be possible as there is an option to do just that in the webclient.

ring_zero February 5, 2015 - 7:35 pm

Very nice work!

KD June 29, 2015 - 1:02 am

i looked at http://www.v-front.de/2014/02/how-to-uprade-your-vms-virtual-hardware.html that suggest during power cycle we can upgrade vmware tools.. Please suggest


Leave a Reply

Chinese (Simplified)EnglishFrenchGermanHindiPolishSpanish