Friday, May 22, 2015

Enable or Disable SSH on all ESXi hosts (onliner)

#Enable/Disable SSH
#MrAmbiG
#Enable SSH on all hosts as below. you can drill down to a prticular cluster as below
#Get-Datacenter "DC" | Get-Cluster "Cluster" | Get-VMHost | Get-VMHostService | where {$_.Key -eq "TSM-SSH"} | Start-VMHostService
#Enable SSH on all hosts using the shotgun method
Get-VMHost | Get-VMHostService | where {$_.Key -eq "TSM-SSH"} | Start-VMHostService
#Disable SSH on all hosts using the shotgun method
#Get-VMHost | Get-VMHostService | where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService