9 Replies Latest reply on Apr 18, 2019 10:55 PM by jvm2016

    vmware tools upgrade_powercli

    jvm2016 Expert

      Hi Luc,

       

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

      most of machines are on esxi6.5 .

        • 1. Re: vmware tools upgrade_powercli
          LucD Guru
          User ModeratorsCommunity WarriorsvExpert

          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)

          }

          • 2. Re: vmware tools upgrade_powercli
            jvm2016 Expert

            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 .

            • 3. Re: vmware tools upgrade_powercli
              LucD Guru
              Community WarriorsUser ModeratorsvExpert

              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.

              • 4. Re: vmware tools upgrade_powercli
                jvm2016 Expert

                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 .

                • 5. Re: vmware tools upgrade_powercli
                  LucD Guru
                  User ModeratorsCommunity WarriorsvExpert

                  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.

                  • 6. Re: vmware tools upgrade_powercli
                    jvm2016 Expert

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

                    • 7. Re: vmware tools upgrade_powercli
                      LucD Guru
                      User ModeratorsvExpertCommunity Warriors

                      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.

                      • 8. Re: vmware tools upgrade_powercli
                        jvm2016 Expert

                        ok .

                        • 9. Re: vmware tools upgrade_powercli
                          jvm2016 Expert

                          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