Home Linux How to Enable SSH on All ESXi Hosts using PowerCLI

How to Enable SSH on All ESXi Hosts using PowerCLI

by admin

To enable SSH on all ESXi hosts connected to a vCenter Server, using PowerCLI, you can use the following steps:

Start by opening a PowerCLI window and connecting to your vCenter server using the following command:

Connect-VIServer -Server <vCenter_server_name>

Once you are connected to the vCenter server, you can use the following command to retrieve a list of all hosts managed by the vCenter server:

Get-VMHost

Next, you can use a foreach loop to iterate over each host in the list and enable SSH on the host using the following command:

foreach ($host in (Get-VMHost)) {   Set-VMHostService -VMHost $host -Key "TSM-SSH" -Policy "on" }

Once the SSH service has been enabled on all hosts, you can verify that it is running using the following command:

Get-VMHost | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"}

That’s it! You have now successfully enabled SSH on all hosts managed by your vCenter server using PowerCLI.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More