1 2 Previous Next 16 Replies Latest reply on Jan 16, 2018 7:12 AM by Gael

    Find HBA/NIC FW and Drivers without SSH/Plink

    Gael Novice

      Hi,

      Is there a command to find HBA/NIC FW and Drivers of multiple ESXi WITHOUT using SSH or plink to ESXi?

      One detail : PowerCli version is 5.8 :(

      Thanks,

        • 1. Re: Find HBA/NIC FW and Drivers without SSH/Plink
          LucD Guru
          vExpertCommunity WarriorsUser Moderators

          For the NIC you could do something like this

           

          Get-VMHost -PipelineVariable esx | %{

              $esxcli = Get-EsxCli -VMHost $_ -V2

              foreach($vmnic in $esxcli.network.nic.list.Invoke() | where{$_.Name -match "^vmnic"}){

                  $esxcli.network.nic.get.invoke(@{nicname=$vmnic.Name}) |

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

                      @{N='vmnic';E={$vmnic.Name}},

                      @{N='Description';E={$vmnic.Description}},

                      @{N='MAC';E={$vmnic.MACAddress}},

                      @{N='Driver';E={$_.DriverInfo.Driver}},

                      @{N='Version';E={$_.DriverInfo.Version}},

                      @{N='Firmware';E={$_.DriverInfo.FirmwareVersion}}

              }

          }

          • 2. Re: Find HBA/NIC FW and Drivers without SSH/Plink
            LucD Guru
            User ModeratorsvExpertCommunity Warriors

            For the HBA, when they are FC, you could do

             

            Get-VMHost -PipelineVariable esx | %{

                $esxcli = Get-EsxCli -VMHost $_ -V2

                $esxcli.storage.san.fc.list.Invoke() |

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

                    Adapter,DriverName,DriverVersion,FirmwareVersion,HardwareVersion

            }

            • 3. Re: Find HBA/NIC FW and Drivers without SSH/Plink
              Gael Novice

              Hi LucD,

              Thanks,

              I've already found these scripts... but if I'm right (need to check) argument "v2" did not exist un get-esxcli from powercli 5.8 :)

              So, I suppose there no other solutions without updating powercli or use plink/ssh command?

              • 4. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                LucD Guru
                vExpertUser ModeratorsCommunity Warriors

                The V2 switch primarily adds an easier way to create and pass parameters to the esxcli commands.

                Pre-V2 you had to pass the exact number of parameters to each call, and replace the ones that didn't need/use by $null.

                 

                But in theory most of the calls can be made through the pre-V2 Get-EsxCli cmdlet as well.

                • 5. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                  Gael Novice

                  It's a good news :)

                  But concretely, how do we "to pass the exact number of parameters to each call, and replace the ones that didn't need/use by $null" ?! I'm not sure to understand your answer :(

                  • 6. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                    LucD Guru
                    vExpertUser ModeratorsCommunity Warriors

                    Let's take a simple example, to add a device.

                    In the old system ($esxcli) you have to specify 2 parameters.

                    In the V2 system ($esxcliv2) there are 2 parameters, but one is optional, and you don't have to give that one.

                    deviceadd.png

                    In practice the same call in the two version would be done like this

                     

                    $esxcli.device.add('vmhba2',$null)

                     

                    $sArg = @{

                        deviceidentifier = 'vmhba2'

                    }

                    $esxcliv2.device.add.Invoke($sArg)

                     

                     

                    To "see" the parameters in the old system, you call the method without any parameters and parenthesis.

                    In the new system, you can extract the hash table with parameters with the CreateArgs method. Then it is just a matter of creating that hash table, and you can leave out the optional entries you don't need.
                    I hope that makes it a bit clearer.

                    • 7. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                      Gael Novice

                      I thought it was clear... until the partial output :)

                      foreach ($VMHost in $VMHosts) {
                      $VMHostName = $VMhost.Name
                      $esxcli = $VMHost | Get-EsxCli
                      $list += $esxcli.storage.san.fc.list.invoke() | Select @{N='VMHost';E={$VMHostName}},Adapter,DriverName,DriverVersion,FirmwareVersion,HardwareVersion # VMHostHBA command #$List += get-VMHostHBA -VMHost $VMHost -Device }

                      Output is only hostname and "vmhba1" & "vmhba2"...

                      • 8. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                        LucD Guru
                        Community WarriorsvExpertUser Moderators

                        Not sure if something went wrong when you copied my code, but that is not the script I gave earlier.

                        And the Get-EsxCli doesn't have the -V2 switch, while you it uses the Invoke() method, which is a V2 feature.

                         

                        Can you try with the script I provided?

                        • 9. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                          Gael Novice

                          I'm sorry, I understood I had to adapt your script due to my current version of PowerCLI.

                           

                          I used your script as is (or almost) :

                           

                          foreach ($VMHost in $VMHosts)
                             { 
                              Get-VMHost -PipelineVariable esx | %{
                               $esxcli = Get-EsxCli -VMHost $_ -V2
                               $esxcli.storage.san.fc.list.Invoke() |
                               Select @{N='VMHost';E={$VMHost.Name}},
                                Adapter,DriverName,DriverBersion,FirmwareVersion,HardwareVersion
                              }
                             }
                          

                           

                          and it returns :

                          Get-VMHost : A parameter cannot be found that matches parameter name 'pipelineVariable'.

                          At [...]

                           

                          + CategoryInfo : InvalidArgument: (:) [Get-VMHost], ParameterBindingException

                          + FullyQualifiedErrorId : NamedParamterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVMHost

                          I've also replaced "esx" by "$VMHost,", Line 1 : Same result ...

                          • 10. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                            LucD Guru
                            Community WarriorsvExpertUser Moderators

                            That is correct, but you also have to drop the Invoke() method.

                            Like this

                             

                            Get-VMHost -PipelineVariable esx | %{

                                $esxcli = Get-EsxCli -VMHost $esx

                                $esxcli.storage.san.fc.list.() |

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

                                    Adapter,DriverName,DriverVersion,FirmwareVersion,HardwareVersion

                            }

                            • 11. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                              Gael Novice

                              I've tested with removing "." before "()"

                               

                              Get-VMHost -PipelineVariable esx | %{

                                  $esxcli = Get-EsxCli -VMHost $esx

                                  $esxcli.storage.san.fc.list() |

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

                                      Adapter,DriverName,DriverVersion,FirmwareVersion,HardwareVersion

                              }

                               

                              But, output is still regarding "PipelineVariable" error

                              Does this parameter works with PowerCLI 5.8?

                              • 12. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                                LucD Guru
                                vExpertCommunity WarriorsUser Moderators

                                Looks like you're on an older PowerShell version as well (check by displaying $psversiontable).

                                Try like this (and yes, that dot shouldn't have been there).

                                 

                                foreach($esx in Get-VMHost){

                                    $esxcli = Get-EsxCli -VMHost $esx

                                    $esxcli.storage.san.fc.list() |

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

                                        Adapter,DriverName,DriverVersion,FirmwareVersion,HardwareVersion

                                }

                                • 13. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                                  Gael Novice

                                  Hu, 3.0 !

                                  Another part to upgrade asap

                                   

                                  Your script remove the error, but not the output : there are only Host & Adapter names...

                                  • 14. Re: Find HBA/NIC FW and Drivers without SSH/Plink
                                    LucD Guru
                                    vExpertCommunity WarriorsUser Moderators

                                    Then I'm afraid that must be something due to the older PowerCLI version.

                                    Don't you have a box somewhere where you can use a newer PowerCLI version?
                                    Why are you obliged to stay with 5.8?

                                    1 2 Previous Next