PowerCLI

 View Only
  • 1.  vmware tools upgrade_powercli

    Posted Mar 04, 2019 11:33 AM

    Hi Luc,

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

    most of machines are on esxi6.5 .



  • 2.  RE: vmware tools upgrade_powercli
    Best Answer

    Posted Mar 04, 2019 11:40 AM

    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)

    }



  • 3.  RE: vmware tools upgrade_powercli

    Posted Mar 04, 2019 12:15 PM

    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 .



  • 4.  RE: vmware tools upgrade_powercli

    Posted Mar 04, 2019 12:48 PM

    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.



  • 5.  RE: vmware tools upgrade_powercli

    Posted Mar 04, 2019 01:16 PM

    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 .



  • 6.  RE: vmware tools upgrade_powercli

    Posted Mar 04, 2019 01:21 PM

    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.



  • 7.  RE: vmware tools upgrade_powercli

    Posted Mar 04, 2019 01:40 PM

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



  • 8.  RE: vmware tools upgrade_powercli

    Posted Mar 04, 2019 01:43 PM

    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.



  • 9.  RE: vmware tools upgrade_powercli

    Posted Mar 04, 2019 02:14 PM

    ok .



  • 10.  RE: vmware tools upgrade_powercli

    Posted Apr 19, 2019 05:55 AM

    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