Monday, October 21, 2013

PowerCLI: How to Enable SSH on an ESXi host

I recently had to SSH into an ESXi host to perform some troubleshooting tasks.  SSH can be enabled  on a host through the Direct Console User Interface (DCUI) or the vSphere Client.  However, a much more efficient method is to leverage PowerCLI:

How to Enable SSH on an ESXi host:
Get-VMHost myesxihost.mycompany.com | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Start-VMHostService
After performing what I needed to do, I proceeded to disable the service with the following:

How to Disable SSH on an ESXi host:
Get-VMHost myesxihost.mycompany.com | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService

 Waaaay faster!