7 Replies Latest reply on Feb 4, 2017 5:13 PM by tdubb123

    restart hostd and vpxa

    tdubb123 Master

      how do I restart hostd and vpxa on a host with powercli? do I need plink or somrthing?

        • 1. Re: restart hostd and vpxa
          Umesh Expert

          Hi,

          Try something like this



          Get-VMHostService -VMHost MyEsx |
          where
          {$_.Key -eq "vpxa"} |
          Restart-VMHostService
          -Confirm:
          $false -ErrorAction SilentlyContinue

          • 2. Re: restart hostd and vpxa
            LucD Guru
            vExpertUser ModeratorsCommunity Warriors

            You can not restart the host service with the Restart-VMHostService cmdlet.

            You'll have to do this from a SSH session to the ESXi node (see KB1003490).


            You can use plink.exe from the PuTTY Suite to do this (provided SSH is allowed).

            There are many example on the use of plink.exe available in this community.

            Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
            • 3. Re: restart hostd and vpxa
              tdubb123 Master

              hi

               

              this is what I have, looks like the parameters got set and host d got restarted but I got errors

               

              $esxhosts = get-cluster -Name "cluster" | Get-VMHost xxxxxx

               

              foreach ($vmhost in $esxhosts) {

               

               

              $esxcli = Get-EsxCli -VMHost $vmhost

              $iscsihba = get-vmhost -Name $vmhost | get-vmhosthba | ? {$_.Type -eq "IScsi"}

              $esxcli.iscsi.adapter.param.set($iscsihba.device,$false,'LoginTimeout','60')

              $esxcli.iscsi.adapter.param.set($iscsihba.device,$false,'RecoveryTimeout','30')

              $esxcli.iscsi.adapter.param.set($iscsihba.device,$false,'NoopOutTimeout','30')

              $esxcli.iscsi.adapter.param.set($iscsihba.device,$false,'NoopOutInterval','30')

               

              plink 'c:\scripts\plink.exe' $vmhost 'root' 'xxxxx' '/etc/init.d/vpxa restart'

              plink 'c:\scripts\plink.exe' $vmhost 'root' 'xxxxx '/etc/init.d/hostd restart'

              start-sleep 10

               

               

              }

              • 4. Re: restart hostd and vpxa
                tdubb123 Master

                Hi I think it worked. when I ran it again.  I want to do rolling restart of vpxa and hostd without all the hosts going into a disconnected state, what would be a good wait time between restarting of vpxa and hostd on each host?

                 

                start-sleep 10?

                • 5. Re: restart hostd and vpxa
                  tdubb123 Master

                  I just tried it with start-sleep 20 and seems to work fine.

                   

                  Thanks

                  • 6. Re: restart hostd and vpxa
                    LucD Guru
                    User ModeratorsCommunity WarriorsvExpert

                    You mean a Start-Sleep between the 2 plink commands?

                    Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                    • 7. Re: restart hostd and vpxa
                      tdubb123 Master

                      yes. the interval. i want to avoid all hosts in a disconnected state when restarting these agents