Friday, August 14, 2015

Enable SSH on Multiple ESXi Hosts With PowerCLI

Enabling SSH on a large cluster of ESXi hosts through both the desktop vSphere client and the vSphere web client can be a real pain and a huge time suck.  Using VMware's PowerCLI, it's really easy to enable SSH on all hosts connected to a vCenter server with one command.

Open PowerCLI, connect to your vCenter server and run the command:

Get-VMHost | Foreach { Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} ) }

To turn it off again:

Get-VMHost | Foreach { Stop-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} ) }

No comments:

Post a Comment