The script doesn't return objects that have a Device property.
Replace $_.Device with $_.LUN.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Have a look at LUN Report – Datastore, RDM And Node Visibility
It produces a report with all LUNs, on which ESXi nodes they are visible, and if they are used (datastore or RDM) or not.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
I just need to get as below, please help...
You could do something like this, but it will only work for VMFS datastores (not for RDM, nor VSAN datastores).
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $esx -V2
$devVMFS = $esxcli.storage.vmfs.extent.list.Invoke().DeviceName
$esxcli.storage.core.device.list.Invoke() |
where{$_.DeviceType -eq 'Direct-Access'} |
Select @{N='VMHost';E={$esx.Name}},
@{N='LUN';E={$_.Device}},
@{N='Attached';E={$_.IsOffline -eq 'false'}},
@{N='Mounted';E={$devVMFS -contains $_.Device}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD, this list all devices on all hosts but I would like to know the status of particular naa or device on all the hosts.
You can filter that with a Where-clause
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
I tried as below and not getting any output
Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $esx -V2
$devVMFS = $esxcli.storage.vmfs.extent.list.Invoke().DeviceName
$esxcli.storage.core.device.list.Invoke() |
where{$_.DeviceType -eq 'Direct-Access'} |
Select @{N='VMHost';E={$esx.Name}},
@{N='LUN';E={$_.Device}},
@{N='Attached';E={$_.IsOffline -eq 'false'}},
@{N='Mounted';E={$devVMFS -contains $_.Device}}
} | where {$_.Device -eq "naa.6006016025903800934b3bf30f59e811"}
The script doesn't return objects that have a Device property.
Replace $_.Device with $_.LUN.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Superb...Thanks you very much for your help