VMware: Configure Multipath Policy via PowerCLI

Tonight I need to configure the Multipath Policy from “Most Recently Used” to “Round Robin (VMware) on our vSphere 4.1 and HP EVA6400 environment. After reading “Configuration best practices for HP StorageWorks Enterprise Virtual Array (EVA) family and VMware vSphere 4” I decided to change the path status

To check the status of the Multipath Policy you can run the following PowerCLI script:

Per host:

Get-VMhost ESXHOST | Get-ScsiLun -LunType disk

image

Per Cluster:

Get-Cluster CLUSTERNAME| Get-VMHost | Get-ScsiLun -LunType disk

 

To change the Multipath Policy you can run the following command:

Per Host:

Get-VMHost ESXHOST | Get-ScsiLun -CanonicalName "naa.6005*" | Set-ScsiLun -MultipathPolicy "roundrobin"

image

Result in vCenter:

image

sanderdaems

Sander Daems is founder and author of this blog and working as a Lead (Sr.) Consultant by UNICA ICT Solutions. Sander has 15+ years experience in IT, primary focus: virtualization and modern worksplace.

More Posts - Website

Follow Me:
TwitterLinkedIn

17 thoughts on “VMware: Configure Multipath Policy via PowerCLI

  1. Pingback: VMware: Настройка Multipath через PowerCLI | Виталий Волнянский - Персональный блог
  2. Here is a faster one-liner:
    get-cluster “Cluster Name” | Get-VMHost | Get-ScsiLun -LunType disk | Where-Object {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”

  3. Robert,

    Your faster one-liner worked for me, but only made the change for the first host in my cluster. The second host remained as it was with some paths as ‘fixed’. I’m fairly new to both PowerShell and PowerCLI, so any help would be appreciated.

    Thanks,
    Doug

  4. Great information, helped in setting for 12 hosts each with 32 disks.

    I wanted to know if there is way to get the LUN nos with the canonical names.

    Thanks,
    Suhail.

  5. Robert LeBlanc :

    Here is a faster one-liner:
    get-cluster “Cluster Name” | Get-VMHost | Get-ScsiLun -LunType disk | Where-Object {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”

    Just applied this one liner no issues works fine in vsphere 5.

  6. My vCenter server having multiple virtual Data center and multiple cluster, so what is the single command to get detail of All DataStore Multi path policy

  7. This is for vSphere 5.1

    $strHost = Get-VMHost
    connect-viserver $strHost
    $esxcli = $strHost | Get-EsxCLI
    $esxcli.storage.nmp.satp.set($null,”VMW_PSP_RR”,”VMW_SATP_ALUA”)
    $strHost | Get-ScsiLun -CanonicalName “naa.6001*” | Set-ScsiLun -Multipathpolicy “roundrobin”
    $esxcli.storage.nmp.device.list() | Where {$_.PathSelectionPolicy -eq “VMW_PSP_RR”} | %{$esxcli.storage.nmp.psp.roundrobin.deviceconfig.set($null,$true, $_.device, 1,”iops”,$null)}
    $esxcli.storage.nmp.device.list() | Where {$_.PathSelectionPolicy -eq “VMW_PSP_RR”} | %{$esxcli.storage.nmp.psp.roundrobin.deviceconfig.get($_.device)}

  8. The result is not completely visible with the comannd Get-VMhost ESXHOST | Get-ScsiLun -LunType disk

    How can I make the display completely for the ConsoleDeviceName and CanonicalName

    Thanks, Kroman

Leave a Reply

Your email address will not be published. Required fields are marked *