PowerCli script to find all ESXi Storage path
Script download >> lunpaths
1. Run below script lunpaths.ps1
==================================
$filepath = “C:\batch”
$filename = “LunPathState”
$AllHosts = Get-VMHost | Sort Name
$reportLunPathState = @()
Write-Host “$(Get-Date -uformat %H:%M:%S) – $($AllHosts.length) hosts to check”
$i = 0
ForEach ($VMHost in $AllHosts) {
$i++
Write-Host “$(Get-Date -uformat %H:%M:%S) – $($i) of $($AllHosts.length) – $($VMHost)”
$VMHostScsiLuns = $VMHost | Get-ScsiLun -LunType disk
ForEach ($VMHostScsiLun in $VMHostScsiLuns) {
$VMHostScsiLunPaths = $VMHostScsiLun | Get-ScsiLunPath
$reportLunPathState += ($VMHostScsiLunPaths | Measure-Object) | Select @{N=”Hostname”; E={$VMHost.Name}}, @{N=”Number of Paths”; E={$_.Count}}, Name, State
$reportLunPathState += $VMHostScsiLunPaths | Select @{N=”Hostname”; E={$VMHost.Name}}, “Number of Paths”, Name, State
}
}
$reportLunPathState | Export-Csv $filepath\$filename.csv -NoType
2. When script complete run you should get report as below.
Please Comment and Subscribe