Check PowerPath version using PowerCLI

Over the weekend, I was asked to get an inventory of PowerPath versions on our multi-host, mixed versions of ESXi clusters. I did some search online but few of the results including the official KB show how to do it at a cluster level for all hosts. Then here are the PowerCLI script I wrote myself:

ESXi 4.0 & 4.1

$cluster = "your_cluster_name"
$vmhosts = get-cluster $cluster | get-vmhost | sort name
foreach ($vmhost in $vmhosts) {
   write-host $vmhost.name -foregroundcolor Green
   try {
     $desc = get-vmhostpatch -vmhost $vmhost| ?{$_.description -like @("PowerPath*")} | Select description
   write-host $desc.description
   }
   catch {write-host "Not Available"}
}

ESXi 5.0 and up

$cluster = "your_cluster_name"
$vmhosts = get-cluster $cluster | get-vmhost
foreach ($vmhost in $vmhosts) {
 write-host $vmhost.name -foregroundcolor Green
 $esxcli = get-esxcli -vmhost $vmhost
 try {
   $esxcli.software.vib.list() | ?{$_.vendor -like "EMC"}
   }
 catch {write-host "Not Available"}
}