6 Replies Latest reply on Dec 16, 2019 3:53 AM by vin01

    Finding VID, DID & SVID from PCI devices in ESXi

    vin01 Hot Shot

      I am trying to get the vendor id and device id for nic and hba adapters but why I am seeing different values when compared with $esxcli.hardware.pci.list() and esxcfg-info

      Here is the script I used

      foreach ($esx in Get-VMHost 'sez00wtr-0625.sweng.ncr.com'| ? { $_.ConnectionState -eq 'Connected' }) {

       

          $esxcli = Get-EsxCli -VMHost $esx

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

          $hba = Get-VMHostHba -VMHost $esx -Type FibreChannel | ? { $_.Status -eq "online" } | select -ExpandProperty Name

          $elxnet = $esxcli.software.vib.list() | ? { $_.name -eq "elxnet" }

          $esxcli.hardware.pci.list() | ? { ($nic -contains $_.VMKernelName) -or ($hba -contains $_.VMKernelName) } | ForEach-Object -Process {

              New-Object PSObject -Property (

                  [ordered]@{

                      Name         = $esx.Name

                      Device       = $_.DeviceName

                      VendorName   = $_.VendorName

                      VendorID     = ( $_.VendorID)

                      DeviceID     = ($_.DeviceID)

                      SubVendorID  = ($_.SubVendorID)

                      nicFWversion = ($esxcli.network.nic.get("vmnic0").driverinfo.version)

                      stFWversion  = ($elxnet.version.substring(0, 14))


                  })

          }


      }

       

      Output

      Esxi Shell output:

       

      Regards
      Vineeth.K
        • 1. Re: Finding VID, DID & SVID from PCI devices in ESXi
          LucD Guru
          vExpertUser ModeratorsCommunity Warriors

          The values are the same, one is displayed in decimal, the other in hex.

          To display in hex format you can use the format operator

           

          "0x{0:x}" -f ( $_.VendorID)

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: Finding VID, DID & SVID from PCI devices in ESXi
            vin01 Hot Shot

            I have tried like this but its still showing incorrect value

            Actual ids displayed for QLogic 10GbE 2P QMD8262-k NDC in shell are as below

            Vendor Id.......................................0x1077

                           |----Device Id.......................................0x8020

                           |----Sub-Vendor Id...................................0x1028

                           |----Sub-Device Id...................................0x1f64

             

            Even I am unable to find vid 0x4215 in vmware Compatibility Guide

             

            I can able to find 0x1077 which is shown in shell prompt.

            Regards
            Vineeth.K
            • 3. Re: Finding VID, DID & SVID from PCI devices in ESXi
              LucD Guru
              User ModeratorsCommunity WarriorsvExpert

              Those values are not corretc in your output.
              The decimal value 4215 is hex 1077.

              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
              1 person found this helpful
              • 4. Re: Finding VID, DID & SVID from PCI devices in ESXi
                vin01 Hot Shot

                Yeah make sense. Is there any way if i can display the values in Hexadecimal format.

                Regards
                Vineeth.K
                • 5. Re: Finding VID, DID & SVID from PCI devices in ESXi
                  LucD Guru
                  Community WarriorsUser ModeratorsvExpert

                  The issue is that the output fields from Get-EsxCli in this case are of type [string].
                  And formatting a string to hex doesn't do anything.

                  You first have to convert the string to int.

                   

                  New-Object PSObject -Property (

                      [ordered]@{

                          Name         = $esx.Name

                          Device       = $_.DeviceName

                          VendorName   = $_.VendorName

                          VendorID     = "0x{0:x}" -f [int]$_.VendorID

                          DeviceID     = "0x{0:x}" -f [int]$_.DeviceID

                          SubVendorID  = "0x{0:x}" -f [int]$_.SubVendorID

                          nicFWversion = ($esxcli.network.nic.get("vmnic0").driverinfo.version)

                          stFWversion  = ($elxnet.version.substring(0, 14))

                      })

                  Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                  1 person found this helpful
                  • 6. Re: Finding VID, DID & SVID from PCI devices in ESXi
                    vin01 Hot Shot

                    Thanks this worked

                    Regards
                    Vineeth.K