VMware Cloud Community
vin01
Expert
Expert
Jump to solution

Host Hardware info with HBA and nic driver information

Can some one help me to complete the below script.I can't able to get HBA and Nic Driver information.


Get-Datacenter | % { 

  $datacenter=$_

  Get-VMhost -Location $datacenter | Get-VMHostHBA -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="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}}

}

Regards Vineeth.K
1 Solution

Accepted Solutions
vin01
Expert
Expert
Jump to solution

Thanks for correcting meSmiley Happy With the help of your previous posts i had done few changes to get exact vendor information for FC and Network cards, now it is showing desired output.

Get-Datacenter | % { 

      $datacenter=$_

      foreach($esx in Get-VMhost -Location $datacenter){

        $esxcli = Get-EsxCli -VMHost $esx

        $nic = Get-VMHostNetworkAdapter -VMHost $esx | Select -First 1 | select -ExpandProperty Name

        $hba =Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |  Select -First 1 |select -ExpandProperty Name

        Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |

        Select @{N="Datacenter";E={$datacenter.Name}},

                @{N="VMHost";E={$esx.Name}},

                @{N="HostName";E={$($_.VMHost | Get-VMHostNetwork).HostName}},

                @{N="version";E={$esx.version}},

                @{N="Manufacturer";E={$esx.Manufacturer}},

                @{N="Hostmodel";E={$esx.Model}},

                @{Name="SerialNumber";Expression={$esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue}},

                @{N="Cluster";E={

                    if($esx.ExtensionData.Parent.Type -ne "ClusterComputeResource"){"Stand alone host"}

                    else{

                        Get-view -Id $esx.ExtensionData.Parent | Select -ExpandProperty Name

                    }}},

                Device,Model,Status,

                @{N="WWPN";E={((("{0:X}"-f $_.NodeWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},

                @{N="WWN";E={((("{0:X}"-f $_.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},

              # @{N="Fnicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($hba.hbadriver).*"} | Select -First 1 -Expand Vendor}},

                @{N="Fnicvendor";E={$esxcli.hardware.pci.list() | where {$hba -contains $_.VMKernelName} |Select -ExpandProperty VendorName }},

                @{N="fnicdriver";E={$esxcli.system.module.get("fnic").version}},

                @{N="enicdriver";E={$esxcli.system.module.get("enic").version}},

               # @{N="Enicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".net.*"} | Select -First 1 -Expand Vendor}}

                 @{N="Enicvendor";E={$esxcli.hardware.pci.list() | where {$nic -contains $_.VMKernelName} |Select -ExpandProperty VendorName }}

                 #@{N="Enicvendor";E={$esxcli.network.nic.list() | where {$vmnic.name -eq $_.vmnic1} | select -First 1 -ExpandProperty Description }}

        }

    }

=================

Output :

-------

errror.JPG

Regards Vineeth.K

View solution in original post

23 Replies
LucD
Leadership
Leadership
Jump to solution

There are commas missing at the end of lines 11 and 13.

The reference to the HBADriver property in the match string should be done differently.

Does this return values for you ?

    Get-Datacenter | % {   

      $datacenter=$_ 

      Get-VMhost -Location $datacenter | Get-VMHostHBA -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="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}} 

    }   


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

Thanks LucSmiley Happy That was my mistake while copying i missed commas.No it is not writing Fnic and Enic driver and vendor details.Can you correct this script to get those details.

I'm missing where to add this ..

$esxcli = Get-EsxCli -VMHost

Because in

$esxcli.software.vib.list()  how to sepecify host and for HBA and nic driver details.

$esxcli.hardware.pci.list() |where {$hbaNames -contains $_.VMKernelName} |select VendorName

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this, that should fix the $esxcli issue.

Note that I didn't get any "enic" information either, I had to change it "cnic".

Does $esxcli.system.module.list() show a "enic" module ?

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="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}}

        }

    }  


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

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 :

qlogic.JPG

=================

Basically I'm trying to get below vendor names for nic and hba devices which we found in vcenter --hardware status --PCI --devics

pci devics.JPG

===================

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}}

        }

    } 

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can get the vendors of the ESX NIC cards in a similar way.

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

    $esxcli = Get-EsxCli -VMHost $esx

    $vnicNames = Get-VMHostNetworkAdapter -VMHost $esx | Select -ExpandProperty DeviceName

    $esxcli.hardware.pci.list() |where {$vnicNames -contains $_.VMKernelName} |

        Select @{N="ESX";E={$esx.Name}},VMKernelName,DeviceName,VendorName,SubVendorID,SubDeviceID

}}

But in you script you looping through all the HBAm how do you plan on including all the NICs that are the ESXi host ?

Perhaps it will be easier if you first draw out what information (which properties) you want in your report.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

tthat's sounds good luc   if possible can we get atleast one nic card vendor info and one Hba vendor info

ffor example: if a host has 6 nic and 4 Hba I need any one nic vendor and any one HBA INFO.

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-Datacenter | % {  

      $datacenter=$_

      foreach($esx in Get-VMhost -Location $datacenter){

        $esxcli = Get-EsxCli -VMHost $esx

        $hba = Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |  Select -First 1

        $nic = Get-VMHostNetworkAdapter -VMHost $esx | Select -First 1

        $esx | Select @{N="Datacenter";E={$datacenter}},

                @{N="VMHost";E={$esx.Name}},

                @{N="HostName";E={$($hba.VMHost | Get-VMHostNetwork).HostName}},

                @{N="ver";E={$esx.version}},

                @{N="Manf";E={$esx.Manufacturer}},

                @{N="Hostmodel";E={$esx.Model}},

                @{Name="SerialNumber";Expression={$esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue}},

                @{N="Cluster";E={

                    if($esx.ExtensionData.Parent.Type -ne "ClusterComputeResource"){"Stand alone host"}

                    else{

                        Get-view -Id $esx.ExtensionData.Parent | Select -ExpandProperty Name

                    }}},

                @{N="HBA Device";E={$hba.Device}},

                @{N="HBA Model";E={$hba.Model}},

                @{N="HBA Status";E={$hba.Status}},

                @{N="WWN";E={((("{0:X}"-f $hba.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},

                @{N="fnicdriver";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($hba.hbadriver).*"} | Select -First 1 -Expand Version}},

                @{N="Fnicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($hba.hbadriver).*"} | Select -First 1 -Expand Vendor}},

                @{N="enicdriver";E={$esxcli.system.module.get("enic").version}},

                @{N="Enicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".net.*"} | Select -First 1 -Expand Vendor}}

        }

    }  


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

Hi Luc,

Bassically I'm looking for  information as below in the below output i only missed information of enic and fnic vendor rest of the stuff is ok.My fnic vendor is OLogic Corp which i can find in vcenter harware tab but how to get these details below script.Can you pls modify the below script to get those details.

finalerror.JPG

=====

Used Script:


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="fnicvendor";E={$esxcli.system.module.get("*scsi-*").vendor}},
              
                @{N="enicdriver";E={$esxcli.system.module.get("enic").version}},

                @{N="Enicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".net.*"} | Select -Expand Vendor}}

        }

    }  

Regards Vineeth.K
vin01
Expert
Expert
Jump to solution

Thanks for updateSmiley Happy I'm sorry i missed this update:smileycool: Ok with this script i can able to get HBA  Vendor information correctly but Still nic vendor is showing as VMware and it is writing only one HBA WWN  details where as it missed second online HBA WWN. I tried to remove Select -First 1 while getting HBA details but its not writing  second online HBA WWN.Can you please correct this details.

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You told me you only needed 1 HBA.

What is returned by ?

$esxcli.software.vib.list() | Select Name,Vendor

Which line in there do you want for your NIC driver ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

Oops i'm sorry that was my mistake I need every online HBA WWN (In my case 2 online HBAs)  If it repeats every information for second HBA WWN its OK.For Example I'm writing sample out for a Host

Datacenter   : test DC

VMHost       : 10.50.37.27

HostName     : ihydvs46k21

ver          : 5.0.0

Manf         : Sun Microsystems

Hostmodel    : Sun Fire X4600 M2

SerialNumber : 0805AM0202

Cluster      : SUN-UAT

HBA Device   : {vmhba0, vmhba1}

HBA Model    : {ISP2422-based 4Gb Fibre Channel to PCI-X HBA, ISP2422-based 4Gb Fibre Channel to PCI-X HBA}

HBA Status   : {online, online}

WWN          : 21:00:00:e0:8b:94:50:ab

fnicdriver   : 2.1.2.38-1OEM.500.0.0.472560

Fnicvendor   : Cisco

enicdriver   : Version 2.1.2.38, Build: 472560, Interface: 9.2 Built on: Aug 15 2012

Enicvendor   : VMware

======================================

Datacenter   : test DC

VMHost       : 10.50.37.27

HostName     : ihydvs46k21

ver          : 5.0.0

Manf         : Sun Microsystems

Hostmodel    : Sun Fire X4600 M2

SerialNumber : 0805AM0202

Cluster      : SUN-UAT

HBA Device   : {vmhba0, vmhba1}

HBA Model    : {ISP2422-based 4Gb Fibre Channel to PCI-X HBA, ISP2422-based 4Gb Fibre Channel to PCI-X HBA}

HBA Status   : {online, online}

WWN          : 21:01:00:e0:8b:b4:7e:ab

fnicdriver   : 2.1.2.38-1OEM.500.0.0.472560

Fnicvendor   : Cisco

enicdriver   : Version 2.1.2.38, Build: 472560, Interface: 9.2 Built on: Aug 15 2012

Enicvendor   : VMware

===================================

yes when i tried for few hosts as $esxcli.software.vib.list() | Select Name,Vendor


as default .net.(nic) vendor name is showing vmware only.

so can we get nic card information using  $esxcli.hardware.pci.list().If not possible its ok ill use one of your earlier script in this post to get nic card vendor information.


Regards Vineeth.K
LucD
Leadership
Leadership
Jump to solution

Ok, try like this

Get-Datacenter | % {  

      $datacenter=$_

      foreach($esx in Get-VMhost -Location $datacenter){

        $esxcli = Get-EsxCli -VMHost $esx

        $nic = Get-VMHostNetworkAdapter -VMHost $esx | Select -First 1

        Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |

        Select @{N="Datacenter";E={$datacenter.Name}},

                @{N="VMHost";E={$esx.Name}},

                @{N="HostName";E={$($_.VMHost | Get-VMHostNetwork).HostName}},

                @{N="ver";E={$esx.version}},

                @{N="Manf";E={$esx.Manufacturer}},

                @{N="Hostmodel";E={$esx.Model}},

                @{Name="SerialNumber";Expression={$esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue}},

                @{N="Cluster";E={

                    if($esx.ExtensionData.Parent.Type -ne "ClusterComputeResource"){"Stand alone host"}

                    else{

                        Get-view -Id $esx.ExtensionData.Parent | Select -ExpandProperty Name

                    }}},

                Device,Model,Status,

                @{N="WWN";E={((("{0:X}"-f $_.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},

                @{N="fnicdriver";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($hba.hbadriver).*"} | Select -First 1 -Expand Version}},

                @{N="Fnicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($hba.hbadriver).*"} | Select -First 1 -Expand Vendor}},

                @{N="enicdriver";E={$esxcli.system.module.get("enic").version}},

                @{N="Enicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".net.*"} | Select -First 1 -Expand Vendor}}

        }

    }  


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

vin01
Expert
Expert
Jump to solution

Thanks Luc this works as per my requirementSmiley Happy Mean while i will work on this script to get exact vendor information of FNIC and Enic correctly using $esxcli.hardware.pci.list() If any ill post you back.Thanks  againg for correct meSmiley Happy

Regards Vineeth.K
Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

Thanks for correcting meSmiley Happy With the help of your previous posts i had done few changes to get exact vendor information for FC and Network cards, now it is showing desired output.

Get-Datacenter | % { 

      $datacenter=$_

      foreach($esx in Get-VMhost -Location $datacenter){

        $esxcli = Get-EsxCli -VMHost $esx

        $nic = Get-VMHostNetworkAdapter -VMHost $esx | Select -First 1 | select -ExpandProperty Name

        $hba =Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |  Select -First 1 |select -ExpandProperty Name

        Get-VMHostHBA -VMHost $esx -Type FibreChannel | where {$_.Status -eq "online"} |

        Select @{N="Datacenter";E={$datacenter.Name}},

                @{N="VMHost";E={$esx.Name}},

                @{N="HostName";E={$($_.VMHost | Get-VMHostNetwork).HostName}},

                @{N="version";E={$esx.version}},

                @{N="Manufacturer";E={$esx.Manufacturer}},

                @{N="Hostmodel";E={$esx.Model}},

                @{Name="SerialNumber";Expression={$esx.ExtensionData.Hardware.SystemInfo.OtherIdentifyingInfo |Where-Object {$_.IdentifierType.Key -eq "Servicetag"} |Select-Object -ExpandProperty IdentifierValue}},

                @{N="Cluster";E={

                    if($esx.ExtensionData.Parent.Type -ne "ClusterComputeResource"){"Stand alone host"}

                    else{

                        Get-view -Id $esx.ExtensionData.Parent | Select -ExpandProperty Name

                    }}},

                Device,Model,Status,

                @{N="WWPN";E={((("{0:X}"-f $_.NodeWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},

                @{N="WWN";E={((("{0:X}"-f $_.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}},

              # @{N="Fnicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".*$($hba.hbadriver).*"} | Select -First 1 -Expand Vendor}},

                @{N="Fnicvendor";E={$esxcli.hardware.pci.list() | where {$hba -contains $_.VMKernelName} |Select -ExpandProperty VendorName }},

                @{N="fnicdriver";E={$esxcli.system.module.get("fnic").version}},

                @{N="enicdriver";E={$esxcli.system.module.get("enic").version}},

               # @{N="Enicvendor";E={$esxcli.software.vib.list() | ? {$_.Name -match ".net.*"} | Select -First 1 -Expand Vendor}}

                 @{N="Enicvendor";E={$esxcli.hardware.pci.list() | where {$nic -contains $_.VMKernelName} |Select -ExpandProperty VendorName }}

                 #@{N="Enicvendor";E={$esxcli.network.nic.list() | where {$vmnic.name -eq $_.vmnic1} | select -First 1 -ExpandProperty Description }}

        }

    }

=================

Output :

-------

errror.JPG

Regards Vineeth.K
Pinball
Enthusiast
Enthusiast
Jump to solution

Morning Luc

Thanks for the work on this script. I've tried using it but end up with no driver Version Info.The script provide no errors to work with as to why it's missing.

I'm using PowerCli 6 on vSphere 5.5 U2

Fnicvendor   : {Emulex Corporation, Emulex Corporation}

fnicdriver   :

enicdriver   :

Enicvendor   : Emulex

Could you please guide me as to where to start looking for the missing piece.

Done so far: $esxcli = Get-EsxCli -VMhost "hostname"

Unable to list the details as a whole to see the syntax of the version.

I might be misunderstanding as to how the query construct works.

Thanks

Johan

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Are you sure you have those drivers installed ?

Do a

$esxcli.system.module.list() | where {$_.Name -like "*enic*"}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
poncia23
Contributor
Contributor
Jump to solution

Hello, I know this is an older thread, how can i export the content to an csv?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Pipe the result to an Export-Csv cmdlet, eventually put a Select-Object before to select only the properties you want.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

You can do something like this.

Save the original script in .ps1 file and call the script and then export the output.

Ex:

.\Hosthardwareinfo.ps1 |Export-Csv -Path 'D:\Temp\hosthardwareinfo.csv' -NoTypeInformation -NoClobber

Regards Vineeth.K
Reply
0 Kudos