vCenter 5.1 List all Storage Devices with Only One Path

We have a large Vmware environemnt with 95 hosts and use Dell Foglist for performance monitor on top of vcenter alerts of course.  One the the items that bothers be in vCenter is there is not way to see all alerts / events from all host from one Window. Anyway I am looking for a way to search the entire datacenter and list all host with only one path to our SAN. Any thoughts or suggestions
LVL 21
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Dell Foglist he, he, that made me laugh, should that be Foglight!

We do this with Powershell/PowerCLI.....I've got a script somewhere, that runs a report...I could upload...

otherwise, you will have to look at all the LUNs, and Click Manage Paths for all LUNs, which takes a while.

Also it depends, on how you have your paths, e.g. dual pathed, quad pathed, becase the total number of paths is displayed....

so if you have 11 LUNs, and dual path, total paths is 22....quad...44

if it's odd, you've got a failed path..... but then you need to find it....and that's where PowerCLI comes in handy.
compdigit44Author Commented:
That's Hancock.. sorry for the typo.. I look forward to checking out your script....
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
typical, try these, although I have an issue running them my PowerCLI seems duff at the moment!

$initalTime = Get-Date
$filepath = "C:tmp"
$filename = "LunPathState"
$date = Get-Date ($initalTime) -uformat %Y%m%d
$time = Get-Date ($initalTime) -uformat %H%M

Write-Host "$(Get-Date ($initalTime) -uformat %H:%M:%S) - Starting"
$AllHosts = Get-VMHost | Sort Name

$reportLunPathState = @()

Write-Host "$(Get-Date -uformat %H:%M:%S) - $($AllHosts.length) hosts acquired"

$i = 0

ForEach ($VMHost in $AllHosts) {
    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

$conclusionTime = Get-Date
Write-Host "$(Get-Date ($conclusionTime) -uformat %H:%M:%S) - Finished"
$totalTime = New-TimeSpan $initalTime $conclusionTime
Write-Host "$($totalTime.Hours):$($totalTime.Minutes):$($totalTime.Seconds) - Total Time"

$reportLunPathState | Out-GridView

$reportLunPathState | Export-Csv $filepath$date$time"-"$filename".csv" -NoType 

Open in new window

#Connect to vCenter Server
Connect-VIServer vcenter

#Get list of ESXi Hosts
$esxihosts = Get-VMHost

$data = ForEach ($esxi in $esxihosts) {
    Write-Progress -Activity "Scanning hosts" -Status ("Host: {0}" -f $esxi.Name) -PercentComplete ($i/$esxihosts.count*100) -Id 0
    $hbas = $esxi | Get-VMHostHba | where-object {$_.Status -eq “online”}
    ForEach ($hba in $hbas) {
        Write-Progress -Activity "Scanning HBAs" -Status ("HBA: {0}" -f $hba.Device) -PercentComplete ($j/$hbas.count*100) -Id 1
        $scsiluns = $hba | Get-ScsiLun
        ForEach ($scsilun in $scsiluns) {
            Write-Progress -Activity "Scanning Luns" -Status ("Lun: {0}" -f $scsilun.CanonicalName) -PercentComplete ($k/$scsiluns.count*100) -Id 2
            $scsipaths = $scsilun | Get-Scsilunpath
            ForEach ($scsipath in $scsipaths) {
                Write-Progress -Activity "Scanning Paths" -Status ("Path: {0}" -f $scsipath.Name) -PercentComplete ($l/$scsipaths.count*100) -Id 3
                New-Object PSObject -Property @{
                    Host = $
                    HBAName = $scsilun.RuntimeName
                    PathSelectionPolicy = $scsilun.MultiPathPolicy
                    Status = $scsipath.state
                    Source = "{0}" -f ((("{0:x}" -f $hba.PortWorldWideName) -split '([a-f0-9]{2})' | where {$_}) -Join ":")
                    Target = $scsipath.SanId
                    LUN = (($scsilun.RunTimeName -Split "L")[1] -as [Int])
                    Path = $scsipath.LunPath

$data | Export-Csv -NoTypeInformation 'ESXiStorageInfo.csv'

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

compdigit44Author Commented:
Thanks I will try this later on when I am back in the office. What is the difference between both scripts
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
one lists paths, the other lists datastores.
compdigit44Author Commented:
Hancock, your answer is spot on as always....
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.