VMware Cloud Community
mjc2001
Contributor
Contributor

Retreiving FC adapter detail from all hosts...

Hi all,

This is my first post on here so please be gentle with me, I am relatively new to Powershell and PowerCLI for VMWare and have delved into attempting to use 'get-esxcli -vmhost v2' against a list of hosts to retrieve the hba adapter details, specifically vmhba driver detail in order to investigate a san connectivity issue.

Once connected, I then drill into this content as follows to retrieve the fc detail I am after, $host.storage.san.fc.list.invoke()

This works fine for newer Synergy 480 Gen10 hardware but for older kit such as a ProLiant BL460c Gen9, It does not list the adapter driver details.

Does anyone know what I am either doing wrong or what I can do to retrieve the details I am after using PowerCLI, I have found other scripts which use ssh via plink and stop/start the ssh service per ESXi host but I find this a bit clunky and unsecure.

Many thanks in advance.

0 Kudos
7 Replies
LucD
Leadership
Leadership

As you discovered, the level of detail, or even the complete lack of it, depends on the brand and type of HW.

Not all HW vendors play nice by putting the info available in the place where VMware commands, like esxcli, expect to find it.

Sometimes running a command from the console is the only option.

With the Posh-SSH module you don't need to be bother with plink.exe and the likes anymore.

See for example my Use Posh-SSH instead of PuTTY post.

You still need to have the SSH service running.


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

0 Kudos
mjc2001
Contributor
Contributor

Hi LucD and thanks very much for your prompt reply and immediate insight to my problem.

I am then based on your recommendations working towards a solution using the Posh-SSH Module however can you suggest how I can retrieve the host FC detail I am looking for?

Also do you know of any reading material for a beginner for PowerCLI?

Thanks again!

0 Kudos
LucD
Leadership
Leadership

Unfortunately I don't have a HPE Proliant to verify this, but, depending on what kind of FC card is used, there have been threads in this community of people obtaining HBA details from such HW.

See for example Re: Get HBA firmware and driver version for all ESXi hosts

There is also another solution presented in How to check FC hba driver & firmware version on ESXi host

And if you have it installed, the iLORest approach might be the best method.

In that case an Invoke-RestMethod call would do the trick.

You can't dive into PowerCLI without decent understanding of PowerShell.

There are a couple of roadmaps from The Crazy Consultant that I quite like.

See

https://thecrazyconsultant.com/powershell-study-guide-core-concepts/

https://thecrazyconsultant.com/powercli-study-guide-core-concepts/


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

0 Kudos
mjc2001
Contributor
Contributor

Hi LucD/All,

To refresh, I am attempting to simply list all of our ESXi hosts current HBA Adapter Driver revision details from an array of HP Proliant servers.

I have not had much luck using PowerCLI as the .NET objects for the HBA's do not seem to be populated and retreiveable using this method unless someone can point me in the right direction?

I am now instead using a direct SSH method as suggested however I am already getting stuck on the initial one liners where I would expect to see the HBA driver details however which is actually retreived I have copied below:

~# /usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -d

-sh: /usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval: not found

I do however receive a result from the following command:

~# esxcfg-scsidevs -a

vmhba0     cciss               link-n/a     block.cciss/c0d0:0                                   (0:5

                                                                                                                              :0.0) Hewlett-Packard Company Smart Array P400i

vmhba1    qla2xxx           link-up     fc.xxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxx     (0:6

                                                                                                                              :5:0.0) QLogic Corp ISP2532-based 8GB Fibre Channel to PCI Express HBA

vmhba2     qla2xxx          link-up     fc.xxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxx     (0:6

                                                                                                                              :5:0.1) QLogic Corp ISP2532-based 8GB Fibre Channel to PCI Express HBA

However I still cannot drill down to retreive the specific driver revision detail (per adapter)

Any ideas?

Many thanks,

Martin.

0 Kudos
LucD
Leadership
Leadership

Did you check KB1002413, it explains how to get the firmware for QLogic HBA.

On a sidenote, you can run these commands via SSH with the Posh-SSH module.
No more need to use plink.exe or the likes.

See for an example Use Posh-SSH instead of PuTTY


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

0 Kudos
mjc2001
Contributor
Contributor

Hi LucD,

You have been an incredible help for me to get through this so far and indeed the KB article you forwarded on to me was really the missing piece of the puzzle I was after so to speak.

I am now however in what would seem to be one last ridiculous hurdle which I have never come across before and that is how to pass the results of the POSH-SSH Function back into a variable.

So below is a snipet of where I attempt to call the Function into a variable:

foreach ($node in $hosts){

$FullListQLogic += Get-SSHResult($Cred,$Node,$GetQLogic)

}

Function Get-SSHResult(){

param (

[PSCredential]$connectionCredentials,

[String]$ESXiHost,

[String]$sshCommand

)

The error I receive is due to the second line of the above snippet of code:

The term 'Get-SSHResult' is not recognised as the name of a cmdlet.

Any ideas as to how I should correctly go about this?

Thanks.

0 Kudos
LucD
Leadership
Leadership

You will have to change the way you pass the parameters to the Get-SSHResult function.
And the function needs to be "known" before you call it.
That is why I place such functions at the beginning of my .ps1 file.

Something like this should work

Function Get-SSHResult()

{

   param (

   [PSCredential]$connectionCredentials,

   [String]$ESXiHost,

   [String]$sshCommand

   )


}


foreach ($node in $hosts)

{

   $FullListQLogic += Get-SSHResult -connectionCredentials $Cred -ESXiHost $Node -sshCommand $GetQLogic

}


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

0 Kudos