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.