How to determine if EMC PowerPath is installed on an ESX host using PowerCLI
TL;DR How can I use PowerCLI to determine if EMC PowerPath is installed on an ESX host?
I am attempting to write a script that will perform a host-masking operation when moving a LUN from one storage group to another. This is to accommodate the All Paths Down error that can occur due to a race condition in ESX 4.1. The steps are described in VMWare KB 1015084 and 1009449. These steps are written for use from the service console. I want to avoid scripting SSH activity and instead do the entire thing in Powershell/PowerCLI.
In our environment, we are using EMC PowerPath on most - but not all - of our hosts. This LUN masking only needs to be performed on hosts where PowerPath is installed, so I am attempting to test each host to determine this.
I have been pulling my hair out trying to determine how to do this with PowerCLI. If connected to the ESX service console, the command esxcfg-mpath --list-plugins will show if PowerPath is installed. In the vCenter GUI, it can be determined by:
Select Host -> Configuration -> Storage Adapters -> Select Adapter -> View Devices -> Examine "Owner" column
Using get-scsilun in PowerCLI returns an object that contains all this information except this Owner column.
I am stumped. I had hoped that a get-esxcli object would have some kind of equivalent methods, maybe in satp or nmp, but so far I can't find anything.
As suggested, I'll answer my own question:
The answer is: $esxcli.corestorage.plugin.list() will return a list of plugins installed on the host.
To get this information from PowerCLI 6.5 you can use the following:
(Get-ESXCLI -VMHost <host>).Storage.Core.Plugin.List()