If you’ve ever needed to SSH to each host in your environment to do some work, you know what a pain it can be to click over to the Security Profile tab and enable it for one host at a time. A much faster way to do this would be with a PowerCLI one-liner. Below are the commands to turn SSH on and off across all hosts. Hope it saves you a few clicks!
[code lang=”powershell”]#Start SSH for all hosts in vCenterGet-VMHost | Foreach {
Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} )
}[/code] [code lang=”powershell”]#Stop SSH for all hosts in vCenter
Get-VMHost | Foreach {
Stop-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} ) -Confirm:$false
}
[/code]