Hello I need to write a report that lists the LUNs preferred path but it seems that PowerCLI does not catch the parameter in question. In the web client H5 I can read them fine. vCenter server 6.5/6816762, ESXi hosts 6U3 6921384 (which include the fixed path bug fix), and Compellent Live Volumes LUNs. Here's the script, it runs fine but it lists zero LUNs. If I change the filter on the Preferred property to False I get all of them. Anybody experiencing this?
$prefpath = foreach($esx in (Get-Cluster myCluster | Get-VMHost)){
foreach($lun in (Get-ScsiLun -VMHost $esx | ?{$_.RuntimeName.Split(":")[3] -notmatch "L256|L257" -and $_.IsLocal -ne "True" -and $_.MultipathPolicy -eq "Fixed"})){
Get-ScsiLunPath -ScsiLun $lun | ?{$_.Preferred -match "True"} | Select @{N="Host";E={$esx.Name}},@{N="LUN";E={$lun.CanonicalName}},LunPath,Preferred
}
}
$prefpath
Can you try with a limited Where-clause?
Just keep the Fixed policy in there, like this
foreach($lun in (Get-ScsiLun -VMHost $esx | Where-Object{$_.MultipathPolicy -eq "Fixed"})){
Does that make any difference?
As an alternative can you check with
foreach($esx in (Get-Cluster -Name myCluster | Get-VMHost)){
$esxcli = Get-EsxCli -VMHost $esx
$esxcli.storage.nmp.device.list() | where{$_.PathSelectionPolicy -eq 'VMW_PSP_FIXED'} |
Select @{N='VMHost';E={$esx.Name}},
Device,
@{N='PathSelectionPolicy';E={$_.PathSelectionPolicy}},
@{N='PreferredPath';E={$_.PathSelectionPolicyDeviceConfig.TrimStart('{').Split(';')[0].Replace('preferred=','')}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Can u just run only below command and check the output
Get-VMHost | Get-ScsiLun -LunType disk
Thanks Raj, obviously command runs fine, what is it you need to check ?
Can you try with a limited Where-clause?
Just keep the Fixed policy in there, like this
foreach($lun in (Get-ScsiLun -VMHost $esx | Where-Object{$_.MultipathPolicy -eq "Fixed"})){
Does that make any difference?
As an alternative can you check with
foreach($esx in (Get-Cluster -Name myCluster | Get-VMHost)){
$esxcli = Get-EsxCli -VMHost $esx
$esxcli.storage.nmp.device.list() | where{$_.PathSelectionPolicy -eq 'VMW_PSP_FIXED'} |
Select @{N='VMHost';E={$esx.Name}},
Device,
@{N='PathSelectionPolicy';E={$_.PathSelectionPolicy}},
@{N='PreferredPath';E={$_.PathSelectionPolicyDeviceConfig.TrimStart('{').Split(';')[0].Replace('preferred=','')}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc, the first does not work and the second suggestion works of course as it pulls info with esxcli. However it is confirmed then that Get-ScsiLunPath does not read the fixed preferred path property. Do you get that too? I don't know if you have any...
Confirmed, I get that too.
I think the PowerCLI Team is aware, but it won't hurt to open a SR on this.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference