Hi, I'm running the following script and getting the error below
# Get information from user
$vc = Read-Host "Please enter the vCenter Server name:"
$uname = Read-Host "Please enter the username to connect to the vCenter server:"
$upass = Read-Host "Please enter the associated password:"
$clusterName = Read-Host "Please enter the Cluster name:"
Write-Host "Connecting to vCenter server $vc, please wait." -BackgroundColor Black -ForegroundColor White
Connect-VIserver $vc -user $uname -password $upass | Out-Null
###
# Retrieve ESX hosts in Cluster
$VMHosts = Get-Cluster $clusterName | Get-VMHost
# Run through this loop for each host in the cluster
foreach ($VMHost in $VMHosts)
{
$luns = @($VMHost|get-scsilun -luntype disk| where-object {$_.ConsoleDeviceName -like "/vmfs/devices/disks/naa*"} | Sort-Object CanonicalName)
$firstLUNPaths = Get-ScsiLunPath -ScsiLun $luns[0]
$numPaths = $firstLUNPaths.Length
$count = 0
foreach ($lun in $luns)
{
if ($count -ge $numPaths)
{
$count = 0
}
$paths = @(Get-ScsiLunPath -ScsiLun $lun)
$lun|Set-ScsiLun -MultipathPolicy VMW_PSP_FIXED_AP -PreferredPath $paths[$count]
$count += 1
# Sleep for 30 seconds to prevent array saturation.
Start-Sleep -Seconds 30
}
}
Here is the error
Set-ScsiLun : Cannot bind parameter 'MultipathPolicy'. Cannot convert value "VM
W_PSP_FIXED_AP" to type "VMware.VimAutomation.ViCore.Types.V1.Host.Storage.Scsi
.ScsiLunMultipathPolicy" due to invalid enumeration values. Specify one of the
following enumeration values and try again. The possible enumeration values are
"Fixed, MostRecentlyUsed, RoundRobin, Unknown".
At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\scripts\fixedp
olicy.ps1:31 char:36
+ $lun|Set-ScsiLun -MultipathPolicy <<<< VMW_PSP_FIXED_AP -PreferredPa
th $paths[$count]
+ CategoryInfo : InvalidArgument: (:) [Set-ScsiLun], ParameterBin
dingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomat
ion.ViCore.Cmdlets.Commands.Host.SetScsiLun
It doesnt appear to like the VMW_PSP_FIXED_AP as the PSP, even though I can set it fine in the GUI. I'm running a Clariion CX4 and moving to this policy instead of round robin to get automatic failback of luns. Am I missing something? The script works fine if I use "FIXED" but I want to use VMW_PSP_FIXED_AP to take advantage of ALUA.
Any help would be greatly appreciated. Thanks!