Greetings,
I have started modifying the script from:
http://vmjunkie.wordpress.com/2009/01/29/balancing-lun-paths-on-your-esx-hosts-with-powershell/
to fit our enviroment. We have our utility LUNs labeled similar to out VM LUNs, but they do not have the same number of paths. Here is the where-object select statement I am using:
Script SNIP:
$luns = $VMHost|get-scsilun -luntype disk|
where-object {$_.ConsoleDeviceName -like "/vmfs/devices/disks/vml*"} |
where-object {$_.CanonicalName -like "vmhba0:0:*"}|Sort-Object CanonicalName
$firstLUNPaths = Get-ScsiLunPath $lun[0]
$numPaths = $firstLUNPaths.Length
The script work fine on the first host in the cluster, but I recieve this error on each host afterwards:
Err:
Unable to index into an object of type VMware.VimAutomation.Client20.Host.ScsiLunImpl.
At C:\hp\Tools\VM_Tools\Scripts\Pathing\Set_Cluster_SAN_Path_t.ps1:37 char:40
+ $firstLUNPaths = Get-ScsiLunPath $lun[0 <<<< ]
Line 37 is:
$firstLUNPaths = Get-ScsiLunPath $lun[0]
If I remove the portion of the select statement:
where-object {$_.CanonicalName -like "vmhba0:0:*"}
The error goes away. Since this is the portion of the select statement that gets the VM LUNs I really would like this to work.
Thanx in advance!
Kevin