2 Replies Latest reply on Nov 13, 2019 11:05 AM by bdmpastx

    How to restart vshield-endpoint-mux via powercli?

    tmcgrath Lurker

      I have an open ticket with VMWare. They are stumped! We have vm's that are disconnecting because the host is causing all the guest o flap the VSEPLFT from connected to disconnected... If I could somehow script :

      /etc/init.d/vShield-Endpoint-Mux start/stop/restart


      Via PowerCLI to run on all hosts in a cluster that would be great! I am having some difficulty today searching, and running out of ideas I have tested a few different ideas with no success.

        • 1. Re: How to restart vshield-endpoint-mux via powercli?
          LucD Guru
          vExpertCommunity WarriorsUser Moderators

          Is SSH enabled on those ESXi nodes?

          Or can it be enabled on those nodes?

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: How to restart vshield-endpoint-mux via powercli?
            bdmpastx Novice

            I have POSH-SSH installed and I was able to build and run this. Replace your ESXi username and password in the single quotes. You must be connected to a vcenter server as well. "Connect-viserver"


            $username = ''

            $Password = ConvertTo-SecureString '' -AsPlainText -Force

            $credential = New-Object System.Management.Automation.PSCredential($username,$Password)


            $Clusters = Get-Cluster

            foreach($cluster in $clusters){

                $esxhosts = Get-VMHost

                foreach($esxhost in $esxhosts){

                    $session = $null

            #Starts SSH services on the ESXi

                    $esxhost|Get-VMHostService | where-object {$_.key -eq "TSM-SSH"} | start-vmhostservice -confirm:$false

                    $esxhost|Get-VMHostService | where-object {$_.key -eq "TSM-SSH"} | Set-VMHostService -Policy Off

            #Start the SSH session with POSH SSH

                    $session = New-SSHSession -Credential $credential -ComputerName $esxhost -AcceptKey:$true

                    If($session -ne $null){

            #Run the command on SSH

                    Invoke-SSHCommand -index $session.SessionId -command "/etc/init.d/vShield-Endpoint-Mux restart"

            #Remove the session


                    }else{write-host "$esxhost has a bad password"}

            #Stop SSH Services on the host

                    $esxhost|Get-VMHostService | where-object {$_.key -eq "TSM-SSH"} | stop-vmhostservice -confirm:$false

                    $esxhost|Get-VMHostService | where-object {$_.key -eq "TSM-SSH"} | Set-VMHostService -Policy On

            #Restart the guest introspection VM. This is needed so that the muxconfig.xml is rebuilt on the ESXi

                    $GIVM = $esxhost|get-vm -name "Guest Introspection*"

                    Restart-VM -VM $GIVM -Confirm:$false}