4 Replies Latest reply on Jan 17, 2013 3:32 PM by Brcko_94

    ESXi 5.0 U1 HBA Details: Power CLI

    Brcko_94 Novice

      Hi All

       

      I'm trying to extract following HBA information from some 250 hosts in multiple clusters:

      - HBA Type

      - Firmware version

      - Driver version

      - BIOS version

       

      I know that all this informatio is given using via "cat /proc/scsi/qla2xxx/x" command but I'm looking for a way to script this and have it exported into a csv file with headings similar to cluster, host name, HBA type, HBA firmware, HBA driver, BIOS.

       

      I've come across couple of scripts that some very smart people here have written, ie "HBA Information: PowerCLI" and "Get HBA hardware details" however:

      1. I'm lead to believe that these scripts work on ESX hosts only and not on ESXi

      2. When executing the script I get following error message:

                Invoke-Expression : The '<' operator is reserved for future use.
                At C:\data\Scripts\HBA\hba_driver_firmware.ps1:15 char:33
                +         $msg = Invoke-Expression <<<<  -command $command
                    + CategoryInfo          : ParserError: (<:OperatorToken) [Invoke-Expression], ParseException
                    + FullyQualifiedErrorId : RedirectionNotSupported,Microsoft.PowerShell.Commands.InvokeExpressionCommand

       

      Can anybody help with this?  I really don't file like obtaining this information manually from some 250 hosts and sorting it manually in the spread-sheet.

       

      Any help would be much appreciated and obvioously rewarded with points. 

        • 1. Re: ESXi 5.0 U1 HBA Details: Power CLI
          RvdNieuwendijk Virtuoso
          vExpertUser Moderators

          Did you modify:

           

          $User = "<user-account>" 
          $Pswd = "<user-password>" 
          $plink = "<PuTTY-directory>\plink.exe"
          
          

           

          into something like:

           

          $User = "root" 
          $Pswd = "TopSecret" 
          $plink = "C:\plink.exe"
          
          

          • 2. Re: ESXi 5.0 U1 HBA Details: Power CLI
            Brcko_94 Novice

            Embarrassing to admit but that was the solution, thank you Robert.

             

            I assumed I didn't have to hard code credentials in the script as I was beeing prompted for username and password when once the script was executed.  Anyway, will have to mask that...don't really want to have that out there in the open.

             

            One more thing tho...when I execute the script the output I get is as following:

                 - ESXname          : <hostname>.my.domain
                 - HBAtype           : QMI3572
                 - HBAfirmware     : 5.06.05
                 - HBAdriver          : 911.
                 - BIOS                : 2.09

             

            However when I run cat /proc/scsi/qla*/* command I get bit more details:

                 - QLogic PCI to Fibre Channel Host Adapter for QMI3572:
                      FC Firmware version 5.06.05 (90d5),

                      Driver version 911.k1.1-26vmw

                      Host Device Name vmhba2

                      BIOS version 2.09
                      FCODE version 3.14
                      EFI version 2.27
                      Flash FW version 5.03.06

             

            The script seems to cut short the FC Firmware version and Driver version and I'd also like to get additional details which are provided when running the command manually, ie FCODE; EFI version and Flash FW version.  Reason I want it is that all these revisions are all over the place on my hosts and would like to bring them all in line and on have the same across the board.

             

            Any help would be much appreciated.

            • 3. Re: ESXi 5.0 U1 HBA Details: Power CLI
              MKguy Virtuoso

              I updated Luc's script to include the info you want:

               

              $qlR1 = [regex]"QLogic.+for\s(\w+):" 
              $qlR2 = [regex]"Firmware version ([\d|\.]+).+Driver version ([^$]+)" 
              $qlR3 = [regex]"BIOS version ([\d|\.]+)" 
              $qlR4 = [regex]"FCODE version ([\d|\.]+)" 
              $qlR5 = [regex]"EFI version ([\d|\.]+)" 
              $qlR6 = [regex]"Flash FW version ([\d|\.]+)"

              $User = "USERNAME" $Pswd = "SECRET"
              $plink = "D:\plink.exe"
              $plinkoptions = " -v -batch -pw $Pswd" $cmd1 = 'cat /proc/scsi/qla*/*' $remoteCommand = '"' + $cmd1 + '"' $report = @() Get-VmHost | Sort | % {         $Computer = $_.Name         $command = $plink + " " + $plinkoptions + " " + $User + "@" + $computer + " " + $remoteCommand         $msg = Invoke-Expression -command $command          $msg | % {                 if($_ -match $qlR1){                         $row = "" | Select ESXname, HBAtype, HBAfirmware, HBAdriver, BIOS, FCODE, EFI, FlashFW
                                      $row.ESXname = $Computer                         $row.HBAtype = $qlR1.Match($_).Groups[1].Value                 }                 if($_ -match $qlR2){                         $matches = $qlR2.Match($_)                         $row.HBAfirmware = $matches.Groups[1].Value                         $row.HBAdriver = $matches.Groups[2].Value                 }                 if($_ -match $qlR3){                         $matches = $qlR3.Match($_)                         $row.BIOS = $matches.Groups[1].Value                         $report += $row                 }                 if($_ -match $qlR4){                         $matches = $qlR4.Match($_)                         $row.FCODE = $matches.Groups[1].Value                         $report += $row                 }                 if($_ -match $qlR5){                         $matches = $qlR5.Match($_)                         $row.EFI = $matches.Groups[1].Value                         $report += $row                 }                 if($_ -match $qlR6){                         $matches = $qlR6.Match($_)                         $row.FlashFW = $matches.Groups[1].Value                         $report += $row                 }         } } $report

               

               

              This yields in my test:

              ESXname     : esxhost1.local
              HBAtype     : HPAE311A
              HBAfirmware : 5.03.15
              HBAdriver   : 901.k1.1-14vmw
              BIOS        : 3.12
              FCODE       : 2.03
              EFI         : 2.22
              FlashFW     : 5.03.15

               

              ESXname     : esxhost1.local
              HBAtype     : HPAE311A
              HBAfirmware : 5.03.15
              HBAdriver   : 901.k1.1-14vmw
              BIOS        : 3.12
              FCODE       : 2.03
              EFI         : 2.22
              FlashFW     : 5.03.15

              1 person found this helpful
              • 4. Re: ESXi 5.0 U1 HBA Details: Power CLI
                Brcko_94 Novice

                Thank you MKguy

                 

                It worked like a charm.  Exactly what I needed.

                 

                Much appreciate your help.

                 

                Cheers