ESXi enable SSH and ESXi Shell using PowerCLI

We can enable SSH & ESXi Shell using GUI or DCUI, but this time I want to show you easier way. Especially if you need to do so for more than single host.

First thing we need to do is to connect to vcenter and select host that we want to operate on:

Then, we need to find out what are the service names of SSH and ESXi Shell:

Lines 7-8 are our targets. Service names are TSM and TSM-SSH (who would guess that? ^^). All we need to do is to change service’s policy from off to on and then restart those services to make sure that they do work properly. Our commands are Set-VMHostService and Restart-VMHostService:

As a result we should see something like that:

Now when our services are working, VMware host will be marked with yellow warning icon because of SSH / ESXi shell being enabled. Of course we can suppress it with PowerCLI 😉

We are done! Here’s the complete powercli script to make life easier:

Ok, but as mentioned at the beginning – you may need this to reconfigure multiple hosts, not a single host. What we can do is foreach loop on the cluster (could also be a datacenter):

Voila!

Leave a Reply