PowerCLI: enable SSH and configure ESXi Firewall

From VI-Toolkit
Jump to navigation Jump to search

PowerCLI: Enable SSH and configure ESXi Firewall

author: Arne Fokkema


By default nowadays a host is not supposed to have SSH enabled as you are supposed to manage your host via the exposed APIs. There are however times when it is really convenient to have SSH access. Instead of just opening SSH and disregarding or ignoring the warning this creates, Arne created a PowerCLI script to enable/disable SSH on need.

The script configures SSH to start automatically, it hides the Shell warning message and will then configure the ESXi firewall to allow the connection from a certain IP address.


Change the $cluster and $ip variables to accomodate your environment. Then copy the script to your PowerCLI session and run it.

$cluster = "<clusterName>"
$ip = ""