$VC=" " $UserName=" " $Password=" " $DataCenterName = "" $ClusterName=" " Function ResetAllLUN2RoundRobin { # Connect to the VCenter server Write-Progress “Gathering Information” “Connecting to Virtual Center” -Id 0 Connect-VIServer –Server $VC –Protocol https –User $UserName –Password $Password $esxservers = get-cluster "$ClusterName" | get-vmhost foreach ($h in $esxservers) { ##$h = get-vmhost $esxserver Write-Progress “Changing…” “Multipathing to Round Robin” -Id 0 $hostView = get-view $h.id $policy = new-object VMware.Vim.HostMultipathInfoLogicalUnitPolicy $policy.policy = “rr” $storageSystem = get-view $hostView.ConfigManager.StorageSystem $storageSystem.StorageDeviceInfo.MultipathInfo.lun | where { $_.Path.length -gt 1 } | foreach { $storageSystem.SetMultipathLunPolicy($_.ID, $policy) } } } ResetAllLUN2RoundRobin