Skip to main content

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:




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.

Popular posts from this blog

Connect-NsxtServer shows "Unable to connect to the remote server"

When you run Connect-NsxtServer in the PowerCLI, it may show "Unable to connect to the remote server".  Because the error message is a little bit confusing with other login issues. It's not easy to troubleshoot. The actual reason is the NSX-T uses a self-signed certificate, and the PowerCLI cannot accept the certificate automatically. The fix is super easy. You need to set the PowerCLI to ignore the invalid certificate with the following command: Set-PowerCLIConfiguration -Scope User -InvalidCertificateAction:Ignore -Confirm:$false

Setup Terraform and Ansible for Windows provisionon CentOS

Provisioning Windows machines with Terraform is easy. Configuring Windows machines with Ansible is also not complex. However, it's a little bit challenging to combine them. The following steps are some ideas about handling a Windows machine from provisioning to post configuration without modifying the winrm configuration on the guest operating system. Install required repos for yum. yum -y install yum -y install yum -y install yum -y install epel-release yum -y install yum-utils yum-config-manager --add-repo Install  Terraform . sudo yum -y install terraform Install  Ansible . sudo yum -y install ansible Install  Kerberos . yum -y install gcc python-devel krb5-devel krb5-libs krb5-workstation

How to List All Users in Terraform Cloud

Terraform has a rich API. However, the API documentation does not mention how to list all users. We can leverage the organization membership API and the PowerShell command  Invoke-RestMethod  to get a user list. 1. Create an organization token in Terraform Cloud. 2. Create the token variable ( $Token ) in PowerShell. $Token = "abcde" 3. Create the API parameters variable in PowerShell. $params = @{ Uri = "" Authentication = "Bearer" Token = $Token ContentType = "application/vnd.api+json" } Note: You need to replace ZHENGWU with your own organization name. And I used 100 at the end of the URI to retrieve the first 100 users. It can be any number.  4. Retrieve the API return and list the user's email address. $Test = Invoke-RestMethod @params $