Awesome to see that you're automating this but SSH is NOT required to perform these operations nor should it be required ... especially as most customers will have SSH disabled by default
Everything you need is available via vSphere API and can be easily consumed using PowerCLI ![]()
# Check whether slpd service is running on ESXi host
Get-VMHost 192.168.30.5 | Get-VMHostService | where {$_.key -eq "slpd"}
Key Label Policy Running Required
--- ----- ------ ------- --------
slpd slpd off False False
# Stop slpd service
Get-VMHost 192.168.30.5 | Get-VMHostService | where {$_.key -eq "slpd"} | Stop-VMHostService -Confirm:$false
Key Label Policy Running Required
--- ----- ------ ------- --------
slpd slpd off False False
This should simplify your automation by quite a bit ![]()