Hi,
I am looking for PowerCLI script which can help me to assign multipath policy to Fixed for the datastore assigned to approx 20 hosts in one cluster
I am running following command but its show error
Get-Cluster "Cluster Name" | Get-VMhost | Get-ScsiLun -CanonicalName "naa.6006016069d03a005e84537b452ae511" -LunType disk | Set-ScsiLun -MultipathPolicy Fixed
Set-ScsiLun : 15-07-2015 03:08:17 Set-ScsiLun | If the MultipathPolicy |
parameter is set to 'Fixed', you must specify the PreferredPath parameter.
At line:1 char:147
+ Get-Cluster "Customer Grid06 Cluster" | Get-VMhost | Get-ScsiLun -CanonicalName "naa.6006016069d03a005e84537b452ae511" -LunType disk | Set-ScsiLun <<<< -MultipathPolicy Fixed
+ CategoryInfo | : InvalidArgument: (:) [Set-ScsiLun], InvalidArgument |
+ FullyQualifiedErrorId : Core_SetScsiLun_TryValidateParameterList_PreferredPathNoSpecified,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.SetScsiLun
Not getting any clue where I am failing on this ? to assign Fixed policy to 20 hosts manually its bit pain
Regards,
Amit Vyas
I went about this a little different. I ran the get-scsilun command and exported to CSV and gathered the model information and then wrote the script below. We had a EMC CX3 that required MRU and a DMX & VMAX that required RR...
foreach ($vmhost in (get-datacenter -Name "Datacenter" | Get-VMHost)) {
Get-VMHost -Name $vmhost | Get-ScsiLun -LunType "disk"|where {$_.Model -eq "Raid 5"}| where {$_.MultipathPolicy -eq "RoundRobin"}| set-scsilun -Multipathpolicy MostRecentlyUsed
Get-VMHost -Name $vmhost | Get-ScsiLun -LunType "disk"|where {$_.Model -eq "SYMMETRIX"}| where {$_.MultipathPolicy -ne "RoundRobin"}| set-scsilun -Multipathpolicy RoundRobin
Get-VMHost -Name $vmhost | Get-ScsiLun -LunType "disk"|where {$_.Model -eq "VRAID"}| where {$_.MultipathPolicy -eq "RoundRobin"}| set-scsilun -Multipathpolicy MostRecentlyUsed
}
Hope this helps.
Hi Amit,
The issue you are seeing is because you dont specify which path the LUN should be using, something similar to this should work for you:
Get-Cluster "Cluster Name" | Get-VMhost | Get-ScsiLun -CanonicalName "naa.6006016069d03a005e84537b452ae511" -LunType disk | Get-ScsiLunPath | Select -First 1 | Set-ScsiLun -MultipathPolicy Fixed
I have added this:
Get-ScsiLunPath | Select -First 1
What this will do is pull back all of the possible paths, it will then select the 1st path, then when you set to fixed it knows to use the 1st path. you could change this to use a specific path if required.
Regards
Steve