1 Reply Latest reply on Feb 12, 2020 12:49 AM by LucD

    VCSA services, health status

    sivagndl Enthusiast

      Hi All,


           How to get VCSA services and health state for using Invoke-VMScript.

          I tried basic one it is not help. Please suggest ?


        • 1. Re: VCSA services, health status
          LucD Guru
          vExpertUser ModeratorsCommunity Warriors

          That will not work via Invoke-VMScript.
          A better alternative is to use SSH (via the Posh-SSH module for example).

          Something like this for example


          $vmName = 'vcsa.my.domain'

          $user = 'root'

          $pswd = 'VMware1!'

          $cmd = @'

          service-control --status


          $cred = [PSCredential]::new($user, (ConvertTo-SecureString -String $pswd -AsPlainText -Force))

          $session = New-SSHSession -ComputerName $vmName -Credential $cred –AcceptKey

          Invoke-SSHCommand -SSHSession $session -Command $cmd | select -ExpandProperty Output

          Remove-SSHSession -SSHSession $session | Out-Null

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz