Skip to content

Tag: iLO

PoSh – HP iLO – Configuring the iLO Hostname

If you’ve had any chance to use the HP Scripting Tools for Powershell at all you might have noticed some inconsistencies specific to the handling of server names. These issues are only made worse when combined with blade enclosures.

The biggest example to illustrate this is by using the get-hpiloservername cmdlet:
Get-HPiLOServerName Output

Now by going to the login screen of the iLO Management page we see:
HP iLO Management Page

Since this is a blade, let’s also see what the Onboard Administrator (OA) Device Bay Summary page says:
HP OA Output

According to the get-hpiloservername output the standard name should be updated to match that everywhere else. The setting in the GUI that we’re looking for is the “iLO Subsystem Name (Host Name)” which is located by way of the Network –> iLO Dedicated Network Port –> General tab area:
iLO Subsystem Name

Instead of reverse engineering the HP module, there’s a workaround available by way of the set-hpilonetworksetting, specifically the DNSName parameter. An example:
Set-HPiLONetworkSetting -Server '' -DNSName 'newserver10' -Credentials (Get-Credential)

One big thing to note, this command does perform a reset against the iLO so if you’re connected to the iLO you will be kicked out and greeted by the following message:
iLO Reset

After the iLO finishes being reset, you can refresh the page and see the newly configured name:
HP iLO Management Page

Then returning to the OA Device Summary page:
HP OA Output

The next logical question is how to automate this process… That’s easy enough!

Let’s check out a section of IPs that are not yet configured with the get-hpilonetworksetting cmdlet:
iLO Hostname Output

Before we run the script, there are some assumptions this script makes:

  • You have the HP Scripting Tools for Powershell modules already installed.
  • You’re running Powershell version 4.0. That’s a requirement for the resolve-dnsname cmdlet to work.
  • DNS entries have already been made and are resolvable.
  • The login credentials are the same for all the iLO systems.

Making sure those bases are all covered it’s time to run the script:

Script output will appear similar to the following: (Note the differences in output)
Script Output

After giving it a minute or two for the iLO resets to be performed, we’ll check out the names again:
iLO Hostname Output

Note: this was a script that worked in my environment. There is no warranty or support with this script, please use at your own risk.

PoSh – HP Scripting Tools for Windows PowerShell

HP has released their Scripting Tools for Windows PowerShell:

After taking a while to figure out where to download it (HP Download Link), the rest was easy. Once downloaded, just unzip the file wherever you like (note: it isn’t unzipping into an install directory) and then run the included executable. Now open up a PowerShell session and you’re good to go…

First thing I did, try and figure out what commands are now available by doing the following command to be greeted by 112 new cmdlets:

Get-Command *HP*

Get Command View

Lots of cool stuff in there that should make life a whole lot easier. I started off by checking out and testing the things I would use most often, like host power info, boot order, UID light changes, etc.

First up, let’s get comfortable with how it works by finding some HP iLO systems:


Find HP iLO

Couple things to note: this is by IP address only, there’s no DNS resolution; IP ranges work, but require patience.

Find HP iLO Name Error

Now that I’ve established that I can find the iLOs and I can find them from versions 2, 3, and 4, let’s do something cool like turn a hosts’ power on. Start off by establishing a host to test with by the find-hpilo command and storing it into a variable to save typing the IP every time. For my convenience, I also stored the username and password into separate variables as there’s no Credential parameter. I check the current status, which I was verifying by connection via web browser to the iLO, I run the following command:

Get-HPiLOHostPower -Server $servervariable -Username $username -Password $password

HP iLO Host Power Status

We can verify that the host’s power is off. Then run the following command to power the system on:

Set-HPiLOHostPower -Server $servervariable -Username $username -Password $password -HostPower "Yes"

HP iLO Host Power On

As you can guess, running the same command only with the HostPower parameter to “No” and it powers the host off. It appears to attempt a graceful shutdown via ACPI.

Set-HPiLOHostPower -Server $servervariable -Username $username -Password $password -HostPower "No"

HP iLO Host Power Off

Next up, turning the UID light off and on. This is especially helpful to locate servers while in the datacenter. The UID follows the same, semi-awkward use of “Yes” and “No” as the HostPower cmdlet does.
Get UID status:

Get-HPiLOUIDStatus -Server $servervariable -Username $username -Password $password

Turn UID on:

Set-HPiLOUIDStatus -Server $servervariable -Username $username -Password $password -UIDControl "Yes"

Turn UID off:

Set-HPiLOUIDStatus -Server $servervariable -Username $username -Password $password -UIDControl "No"

HP UID Status

Last but not least, let’s change the boot order.
Showing the current boot order:

Get-HPiLOOneTimeBootOrder -Server $servervariable -Username $username -Password $password

Change the boot order over to CDROM:

Set-HPiLOOneTimeBootOrder -Server $servervariable -Username $username -Password $password -Device "CDROM"

HP Boot Order Status

Review time: It’s a solid start by HP to get into realm of PowerShell administration of their servers. The big pieces are there and functional and I plan to add this tool into my arsenal immediately. With that said, there are some oddities, such as yes/no answers instead of on/off and gathering the event logs into an array instead of a table format. There’s some other stuff that I’m sure will come as the product starts to evolve, hopefully items like piping a find-hpilo into a get-hpilo cmdlet and adding in a credential parameter instead of forcing a username/password with each use of the cmdlet. Overall, if you have HP servers in your environment and use PowerShell at all, this is definitely something you should be checking out.