UPDATE
The script below will do it by cluster, and is significantly faster. This way it only looks for datastores that are not already set to round robin. The previous script sets everything even if it was already set.
Connect-VIServer vCenterServer
get-cluster “Cluster Name” | Get-VMHost | Get-ScsiLun -LunType disk | Where-Object {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”
Old Way:
Connect-VIServer vCenterServer
foreach ($hostx in get-vmhost) {
$hostview = Get-View $hostx
$storageSystem = Get-View $hostview.ConfigManager.StorageSystem
$policy = new-object VMware.Vim.HostMultipathInfoLogicalUnitPolicy
#$policy.policy = “VMW_PSP_MRU”
$policy.policy = “VMW_PSP_RR”
$storageSystem.StorageDeviceInfo.MultipathInfo.lun | foreach { $storageSystem.SetMultipathLunPolicy($_.ID, $policy) }
}