PowerCLI

 View Only
  • 1.  VCSA services, health status

    Posted Feb 12, 2020 05:18 AM

    Hi All,

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

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



  • 2.  RE: VCSA services, health status

    Posted Feb 12, 2020 08:49 AM

    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