HP has released their Scripting Tools for Windows PowerShell: http://www.hp.com/go/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-HPiLO

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.