VMware Cloud Community
konfigurationki
Contributor
Contributor

Round Robin

How can I use powercli to make all my hosts use round robin on the storage?

0 Kudos
2 Replies
LucD
Leadership
Leadership

One way of doing this

Get-VMHost | Get-ScsiLun -LunType disk |

Set-ScsiLun -MultiPathPolicy RoundRobin -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

cliffcahill
Enthusiast
Enthusiast

Discover all Host in vCenter Server and configure Round Robin om disk that do not have Round robin Configured.

Replace the $clusterName = '*'  Variable with a specific clustername  if you want to target 1 Cluster in particular

==========================

param(

  [Parameter(Mandatory=$true)]$vCenter,

  $VMhost ="*",

  $clusterName = '*'

  )

#End Setting Paramters for Scripts

#Connect to vCenter

Write-Verbose "Connecting to vCenter"

$server = Connect-VIServer $vCenter -credential $(get-credential)

$cluster = Get-Cluster $clusterName

if (!$cluster) {Write-host -foregroundcolor red "ERROR: ERROR: Cluster $clusterName cannot be found"; exit}

ForEach ($VMhostname in ($cluster | Get-VMHost -name $VMhost)| sort)

{

$VMhostname | Get-ScsiLun -LunType "disk"|where {$_.MultipathPolicy -ne "RoundRobin"} | Set-ScsiLun -MultipathPolicy Roundrobin

}