PowerCLI to Change Default Multipathing Policy

PowerCLI to Change Default Multipathing Policy

As it would seem in my environment the default multipathing policy changes with the seasons.  We have become very accustom to making these changes based on the newest whitepaper from the storage vendor.

To change the default multipathing policy, you will need to know the name of the Storage Array Type Plugin (SATP) that you need to change the Native Multi-Pathing (NMP) policy for.

Below is a chart with all of the SATP:
Chart of SATPTo see a list of the current configurations of the SATPs you will can use the following script to list it.

$VMhost = Get-VMHost VMhostName
$esxcli = Get-esxcli $VMHost
$esxcli.storage.nmp.satp.list()

The results of the code is as follows:
esxcli.storage.nmp.satp.list
Now to make the changes, the following code will be needed:

[PS]
$VMhosts = Get-cluster ClusterName | Get-VMhost
foreach ($VMhost in $VMhosts){
$esxcli = Get-esxcli $VMHost
$defaultpsp = “VMW_PSP_RR”
$satp = “VMW_SATP_INV”
$esxcli.storage.nmp.satp.set($null,$defaultpsp,$satp)
}
[/PS]

This change will not change the multipathing that is currently in place, but this will change it after the host is rebooted. Now if you are unable to reboot the host, use the following to change the policy.

[PS]
Get-cluster $ClusterName | Get-VMHost | Get-ScsiLun -LunType disk | Where Model -eq “Invista” | Set-ScsiLun -MultipathPolicy “RoundRobin”
[/ps]

Below is a sample of the output from the above script.

multipathing change on host-Stuart

2 thoughts on “PowerCLI to Change Default Multipathing Policy”

  1. Some storage devices require a change to the number of IOPS before switching round robin paths. For instance, Dell Compellent wants it set to 3, instead of the default of 1000.

    [PS]
    Get-VMHost | Get-ScsiLun -LunType Disk | Where-Object {$_.MultiPathPolicy -like ‘RoundRobin’} | Where-Object {$_.Vendor -like ‘COMPELNT’} | Where-Object {$_.CommandsToSwitchPath -notlike ‘3’} | Set-ScsiLun -CommandsToSwitchPath 3
    [/PS]

    -Tim

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.