Home > VMware > Enable/Disable SSH service on vCenter hosts

Enable/Disable SSH service on vCenter hosts

January 3rd, 2013 Leave a comment Go to comments

Managing ESXi hosts services through PoverCLI interface.

Enable SSH Service on all hosts. Parameter -Policy values on|off|automatic :


PowerCLI> get-vmhost | %{ Get-VMHostService -vmhost $_ } | Where { $_.Key -eq "TSM-SSH"} |Set-VMHostService -Policy "on"

Key Label Policy Running Required
--- ----- ------ ------- --------
TSM-SSH SSH on False False
TSM-SSH SSH on True False
TSM-SSH SSH on True False
TSM-SSH SSH on False False
TSM-SSH SSH on False False
TSM-SSH SSH on True False

Check if hosts have stopped services:

PowerCLI> get-vmhost | %{ Get-VMHostService -vmhost $_ } | Where { $_.Key -eq "TSM-SSH"} | where { ! $_.Running }

Key Label Policy Running Required
--- ----- ------ ------- --------
TSM-SSH SSH on False False
TSM-SSH SSH on False False
TSM-SSH SSH on False False

Start services if needed:

PowerCLI> get-vmhost | %{ Get-VMHostService -vmhost $_ } | Where { $_.Key -eq "TSM-SSH"} | where { ! $_.Running } | Start-VMHostService

Key Label Policy Running Required
--- ----- ------ ------- --------
TSM-SSH SSH on True False
TSM-SSH SSH on True False
TSM-SSH SSH on True False

Check if services started normally:

PowerCLI> get-vmhost | %{ Get-VMHostService -vmhost $_ } | Where { $_.Key -eq "TSM-SSH"} | %{ $_.vmhost.name + " -- " + $_.Policy + " -- " + $_.Running }
host01 -- on -- True
host02 -- on -- True
host03 -- on -- True
host04 -- on -- True
host05 -- on -- True
host06 -- on -- True

Categories: VMware Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.