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