PowerCLI one-liner to find storage devices not configured for round robin PSP.

We recently audited all of our storage configurations and got a lot of mileage out of the following PowerCLI one-liner. This script checks all hosts connected to your vCenter for remote LUN’s that aren’t using the round robin PSP. HP recommends round robin for their 3PAR arrays, but your vendor may recommend another policy. If so just replace “RoundRobin” with “MostRecentlyUsed” or “Fixed“.

Get-VMHost | Sort Name | Get-ScsiLun -LunType disk | Where { $_.MultipathPolicy -ne "RoundRobin" -and $_.islocal -ne "$true"} | Select VMHost, CanonicalName, Vendor, MultipathPolicy

To automatically change the PSP’s, you could just pipe Set-ScsiLun -MultipathPolicy “RoundRobin” (or “MostRecentlyUsed” or “Fixed“) in place of the select statement at the end. Just make sure you understand the risks before executing any changes. We chose a less automated approach to making changes to our production environment.

Matt Bradford

Leave a Reply