Hello,
Can some one help me to provide a ESXi hosts multipath validation script? - ESXi OS version 6.5
TIA
Sure.
If you place the names of the ESXi nodes in a .txt file, one name per line, you could do something like this.
$report = foreach ($esx in Get-VMHost -Name $esxNames)
{
$esxcli = Get-EsxCli -VMHost $esx -V2
foreach ($adapter in $esxcli.storage.core.adapter.list.Invoke() | where { $_.Driver -match 'fc' })
{
$esxcli.storage.core.path.list.Invoke() | where { $_.Adapter -eq $adapter.HBAName } |
Group-Object -Property Device |
Select @{N = 'VMHost'; E = { $esx.Name } },
@{N = 'HBA'; E = { $adapter.HBAName } },
@{N = 'Device'; E = { $_.Name } },
@{N = 'Path#'; E = { $_.Group.Count } },
@{N = 'PathStatus'; E = { ($_.Group.State | Sort-Object -Unique) -join ',' } }
}
}
$report | Export-Csv .\report.csv -NoTypeInformation -UseCulture
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What exactly do you mean by "validation"?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Or is this similar to your other thread (see Re: Mulitpath validation script not giving the right output after upgrading the ESXi version from 5.... )
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thank you so much. I couldn't find that before.
however, can you help to modify that script in the below manner please -
the existing script generating the output of the entire vCenter. But, I would like only few esxi hosts mulitpath status from the vCenter.
say example, in one of the vCenter, there are about 200 ESXi hosts, but, I want only 20 hosts multipath status is required. I want to input the host names how many that I needed.
Could you please help to modify the script that way ?
TIA
Sure.
If you place the names of the ESXi nodes in a .txt file, one name per line, you could do something like this.
$report = foreach ($esx in Get-VMHost -Name $esxNames)
{
$esxcli = Get-EsxCli -VMHost $esx -V2
foreach ($adapter in $esxcli.storage.core.adapter.list.Invoke() | where { $_.Driver -match 'fc' })
{
$esxcli.storage.core.path.list.Invoke() | where { $_.Adapter -eq $adapter.HBAName } |
Group-Object -Property Device |
Select @{N = 'VMHost'; E = { $esx.Name } },
@{N = 'HBA'; E = { $adapter.HBAName } },
@{N = 'Device'; E = { $_.Name } },
@{N = 'Path#'; E = { $_.Group.Count } },
@{N = 'PathStatus'; E = { ($_.Group.State | Sort-Object -Unique) -join ',' } }
}
}
$report | Export-Csv .\report.csv -NoTypeInformation -UseCulture
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference