PowerShell Friday: Managing HA with PowerCLI

Posted on January 15, 2016 • 2 min read • 405 words
vSphere High Availability (HA) is one of those features that usually “just works” – until your cluster starts filling up or a host fails. Then it suddenly…
PowerShell Friday: Managing HA with PowerCLI

vSphere High Availability (HA) is one of those features that usually “just works” – until your cluster starts filling up or a host fails. Then it suddenly matters to see quickly how HA is configured and whether the settings still match your cluster’s current load. In this short PowerShell Friday we show how a few PowerCLI one-liners give you fast insight into your HA configuration.

Prerequisites  

Before you start, you need:

  • PowerCLI installed on your workstation or jump server
  • A connection to your vCenter Server (Connect-VIServer)
  • vSphere clusters with HA enabled

Once you are connected to vCenter you can run the commands below directly.

Check the status of HA Admission Control  

HA Admission Control determines whether the cluster still has enough capacity to restart virtual machines after a host failure. In environments that have grown slowly over time, you will often find this setting was chosen deliberately once but is no longer reviewed.

With the one-liner below you can quickly see per cluster whether HA Admission Control is on or off:

Get-VMHost | Get-Cluster | Select Name, HAAdmissionControlEnabled
  • Get-Cluster retrieves all clusters in your vCenter.
  • Select Name, HAAdmissionControlEnabled shows only the cluster names and whether admission control is enabled (True/False).

This gives you at a glance an overview of all clusters where Admission Control may be unintentionally off, or on when you do not want it to be.

Check HA status levels and behaviour  

Besides admission control there are several other important HA settings that determine what happens during a failover:

  • HAFailoverLevel: the configured failover level (for example the number of host failures).
  • HARestartPriority: the priority with which VMs are restarted after a host failure.
  • HAIsolationResponse: what happens to a host when it becomes isolated (for example “Power off” or “Do nothing”).

Use the following one-liner to retrieve these values per cluster:

Get-VMHost | Get-Cluster | Select Name, HAFailoverLevel, HARestartPriority, HAIsolationResponse

This command helps you:

  • Verify whether the configured failover levels still fit the current size of your cluster.
  • Compare HA settings across different environments (acceptance vs. production).
  • Document your HA configuration without clicking through every vSphere Client screen manually.

With these simple PowerCLI commands you quickly get insight into the most important HA settings of your vSphere clusters, without having to click through the GUI. Ideal for periodic health checks, documentation, and troubleshooting.

See also

    Follow me