How to get HP ProLiant blade server and enclosure information

An enterprise infrastructure administrator needs to run plenty of reports for firmware, software version, or any kind of infrastructure data in their day-to-day operation. Some vendors provide powerful tools to pull out data from their solution, but what if you don’t have such tools? It is pain to get data manually especially for large number of servers. I’m going to share my trick to you. I’ll use HP ProLiant blade system for example, as it’s very common case in enterprise datacenter.

As you may know, HP provides CLI for OA, VC and ILO. It’s easy to get whatever you need by the CLI on individual server, but I’ll show you how to get data on multiple servers. I’m assuming you are familiar with CLI and HP infrastructure. If you are not familiar with that, please refer to HP ProLiant Servers and HP Enterprise Information Library. You also recommend to familiar with PowerShell, but it doesn’t matter in this article since I have tried my best to make the script simple.

For example, you have 1000 HP c7000 enclosures, you want to know OA version of each enclosure.

We need following items be prepared to get it:

PowerShell

plink.exe

Notepad

HP enclosure CLI is available under SSH, it’s kind of UNIX command line. I’ll transfer the CLI data to PowerShell then format the output.

plink.exe is able to run SSH command and get all output back to Windows, so we’ll use it as a bridge between HP CLI and Windows PowerShell.

You’d better create a folder to organize all files together to make it easy for read, for example folder “Scripts”. Then copy plin.exe to the folder and create files test.ps1, list.txt and oa_info.txt.

Open list.txt by notepad and put your entire OA DNS names of HP enclosure to the file. Keep one name for each line.

Open oa_info.txt by notepad and put HP OA CLI command in the file, that’s the command you usually run on SSH, I put show OA info here.

Open test.ps1 by notepad and copy following scripts to the file.

$Enclosures = Get-Content “C:Scriptslist.txt”

$username = “Your OA credential

$password = “Your OA credential

Foreach ($encl in $Enclosures) {

$encl | Out-File C:ScriptsGet-OA-Firmwareoutput.txt -Append

$Output=.plink.exe -ssh $encl -l $username -pw $password -m oa_info.txt | Select-String “Serial Number”,”Firmware Ver”

$Output | Out-File C:ScriptsGet-OA-Firmwareoutput.txt -Append

}

Let me decode the script by human language J

Test.ps1 script reads list.txt to an array, and then initializes variables. (Please make sure your OA system is integrated with AD if you want to run reports for multiple enclosures.) You have to enter your OA credential for OAs, then script starts work on each OA. It calls plink.exe to login each OA by your credential and run the command line in oa_info.txt. Then returns all the lines include keyword Serial Number and Firmware Ver to $Output.

Last step is save data in $Output to output.txt.

This is just very basic script, you can also do some formatting before output it to file.

Advertisements

9 thoughts on “How to get HP ProLiant blade server and enclosure information

  1. Anonymous

    Hi Wu,

    Thanks for the Scripts. It works fine.
    You have said that you will be sharing a new script which uses PowerShell API. ?
    Is it already shared ?

    Reply
  2. Abhinav

    Thank you worked for me

    $Enclosures = Get-Content “C:Scriptslist.txt”

    $username = “Your OA credential”

    $password = “Your OA credential”

    Foreach ($encl in $Enclosures) {

    $encl | Out-File C:ScriptsGet-OA-Firmwareoutput.txt -Append

    $Output=%path%/.plink.exe -ssh $encl -l $username -pw $password -m oa_info.txt

    $Output | Out-File C:ScriptsGet-OA-Firmwareoutput.txt -Append

    }

    Reply
    1. Wu Post author

      It’s a protocol, you could run command line on it, something similar like Windows CMD. You can try connect your OA IP address by Putty.

      Reply
    1. Wu Post author

      Hi Diwakar,
      This script is not ideally for me since it’s grab text from ssh output. I’ll share another script later which uses PowerShell API.

      Reply
      1. Wu Post author

        Unfortunately, I don’t have this kind of script in hands. I’ll share if I can develop one. I’m sorry.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s