Configure VMware Datastore Multipath Policy by Disk Type

May 27, 2015

Here is a VMware vSphere PowerClI script that will find all datastores that are of the model Hitachi – Open-V, set the multipath policy to RoundRobin if it is anything else.

$clustername = ‘clustersomething’
$datastore = get-datastore

# Find datastores by HITACHI, model OPEN-V and multipath not RoundRobin and Change to RoundRobin
$disks = get-cluster $clustername | get-vmhost | get-scsilun -luntype disk | where {$_.Vendor -eq “HITACHI” -And $_.Model -eq “OPEN-V” -And $_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”

#Test the policy for one ESX host
#$disks = get-vmhost esx-host-name | get-scsilun -luntype disk | where {$_.Vendor -eq “HITACHI” -And $_.Model -eq “OPEN-V” -And $_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”

$entry = @()
$output = @()
ForEach ($disk in $disks){

$disk | Export-Csv .\disk.txt

$entry = “” | Select DataStorename, HostName, Canonicalname, Multipathing
$entry.datastorename= $datastore | Where-Object {($ | %{$_.diskname}) -contains $disk.canonicalname}|select -expand name
$entry.HostName = $disk.VMHost.Name
$output += $entry
$output | Export-csv ‘c:\apply-multipath-result.csv’

#Write result to screen
#write-output $output

Be Sociable, Share!


Leave a Reply