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 20
Who is Participating?
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

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....
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.