VMware Cloud Community
sivagndl
Enthusiast
Enthusiast

VCSA services, health status

Hi All,

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

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

pastedImage_2.png

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

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: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos