Luc I used $esxcli.system.module.get to get fnic version also now its ok its pulling "net-enic" & "scsi-fnic" but i can't able to pull exact vendor information like Qlogic etc..which i tried below code which was given by you gives exact info like vendor Qlogic corp etc..
====================================
&{foreach($esx in Get-VMHost){
$esxcli = Get-EsxCli -VMHost $esx
$hbaNames = Get-VMHostHba -VMHost $esx -Type FibreChannel | Select -ExpandProperty Name
$esxcli.hardware.pci.list() |where {$hbaNames -contains $_.VMKernelName} |
Select @{N="ESX";E={$esx.Name}},VMKernelName,DeviceName,VendorName,SubVendorID,SubDeviceID
=====================================================
Output :
=================
Basically I'm trying to get below vendor names for nic and hba devices which we found in vcenter --hardware status --PCI --devics
===================
Can you add $esxcli.hardware.pci.list() |where {$_. -contains $_.VMKernelName} |select VendorName to below code to get HBA and Nic vendor names as above.
Get-Datacenter | % {
$datacenter=$_
foreach($esx in Get-VMhost -Location $datacenter){
$esxcli = Get-EsxCli -VMHost $esx
Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |
Select @{N="Datacenter";E={$datacenter}},
@{N="VMHost";E={$_.VMHost.Name}},
@{N="HostName";E={$($_.VMHost | Get-VMHostNetwork).HostName}},@{N="ver";E={$_.VMhost.version}},@{N="Manf";E={$_.VMhost.Manufacturer}}, @{N="Hostmodel";E={$_.VMhost.Model}},@{Name="SerialNumber";Expression={$_.VMhost.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue}},
@{N="Cluster";E={
if($_.VMHost.ExtensionData.Parent.Type -ne "ClusterComputeResource"){"Stand alone host"}
else{
Get-view -Id $_.VMHost.ExtensionData.Parent | Select -ExpandProperty Name
}}},
Device,Status,
@{N="WWN";E={((("{0:X}"-f $_.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},
@{N="HBA Model";E={($_.VMhost | get-vmhosthba -Type FibreChannel | where {$_.Status -eq "online"} | select-object -ExpandProperty Model ) | Get-Unique}},
# @{N="fnicdriver";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($_.hbadriver).*"} | Select -Expand Version}},
@{N="fnicdriver";E={$esxcli.system.module.get("fnic").version}},
@{N="Fnicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($_.hbadriver).*"} | Select -Expand Vendor}},
@{N="enicdriver";E={$esxcli.system.module.get("enic").version}},
@{N="Enicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".net.*"} | Select -Expand Vendor}}
}
}