Notes of a scripter

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:
To 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:

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.

-Stuart

Exit mobile version