Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 178776

Script to pull storage path information for specific esxi hosts.

$
0
0

Hello All,

 

I want to view the storage path status and count of each dead and active path for specific hosts. I've got below script , however I want to modify the script to add input file where I can specify the list of ESXi hosts which the script would query. Any input will be greatly appreciated,

 

&{foreach($esx in Get-VMHost){

    $esxcli = Get-EsxCli -VMHost $esx -V2

    foreach($adapter in $esxcli.storage.core.adapter.list.Invoke() | where{$_.Driver -match 'fc'}){

        $obj = [ordered]@{

            VMHost = $esx.Name

            Adapter = $adapter.HBAName

            Active = 0

            Standby = 0

            Dead = 0

        }

        $esxcli.storage.core.path.list.Invoke() | where{$_.Adapter -eq $adapter.HBAName} |

        Group-Object -Property State | %{

            $obj."$($_.Name)" = $_.Group.Count

        }

        New-Object PSObject -Property $obj

    }

}} | Export-Csv report.csv -NoTypeInformation -UseCulture


Viewing all articles
Browse latest Browse all 178776

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>