VMware Cloud Community
jvm2016
Hot Shot
Hot Shot
Jump to solution

vmware tools upgrade_powercli

Hi Luc,

can you suggest the easisest way of upgrading vmware tools on multiple machine through powercli.

most of machines are on esxi6.5 .

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can schedule the VMware Tools upgrade at the next restart of the VM.

$do = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec

$do.Tools = New-Object VMware.Vim.ToolsConfigInfo

$do.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle"


Get-VM |

   ForEach-Object -Process {

   $_.ExtensionData.ReconfigVM_Task($do)

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
9 Replies
LucD
Leadership
Leadership
Jump to solution

You can schedule the VMware Tools upgrade at the next restart of the VM.

$do = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec

$do.Tools = New-Object VMware.Vim.ToolsConfigInfo

$do.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle"


Get-VM |

   ForEach-Object -Process {

   $_.ExtensionData.ReconfigVM_Task($do)

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

this is something when vmwaretools are provided by esxi image .is that correct?

is there any change in process or requirment why we will go for downloading .iso for vmware tools from vmware.com .

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The ISO files containing the VMware Tools installation files, for different types of guest OS, live on the ESXi nodes (in folder /vmimages/tools-isoimages).

You can download newer versions of the ISO from the VMware download site, and then copy the file to the ESXi folder.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

Thanks Luc.

However iam not tempted to download vmware tools from vmware.com and want to use whatever  live on the ESXi nodes (in folder /vmimages/tools-isoimages).

i think that should be the best option .

once i run your code it will be displayed as current in webclient but actual upgrade will hapen when we next reboot .

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I think you should only upgrade the ISO files in rare exceptions.

These ISO files are often updated when you patch your ESXi nodes.

That way you are also sure they correspond with the ESXi version and build.Web Client it will still show Update needed, but

No, afaik the status will only show "current" when the upgrade actually took place.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

thnaks iam going to run yur code .just think if we could have incorporated whatif switch .

0 Kudos
LucD
Leadership
Leadership
Jump to solution

What would that WhatIf switch need to do?
We are calling an API method, not a cmdlet I'm afraid.
That is also why Update-Tools does not have a WhatIf switch.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

ok .

0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

Hi Luc ,

i tested your code on one of the vms.

$vms="vm1"

$do = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec

$do.Tools = New-Object VMware.Vim.ToolsConfigInfo

$do.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle"

Get-VM $vms |

   ForEach-Object -Process {

   $_.ExtensionData.ReconfigVM_Task($do)

}

after that i run

Restart-VMGuest -VM $vms

it worked fine however there was messageon console to reboot system for upgrade to take place .i belive that came from restart-vmguest command not  from the reconfiguration task

pastedImage_0.png

0 Kudos