Skip to content

PoSh – HP Scripting Tools for Windows PowerShell

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.

Published inPowershellWindows Server

5 Comments

  1. Mark Gladson Mark Gladson

    Looks like the links for downloading the ilo cmdlets are broken on the hp site. Any chance you still ahve the installer?

    Good article, hoping to use this to help automate powering up my lab 🙂

    Thanks!

  2. Murali Murali

    Hi,
    Thanks for sharing this. Have you been able to alter the bios setting to pxe boot on a particular NIC [nic1 or nic2].

    • kmruddy kmruddy

      That’s not something I have attempted. Normally I configure PXE setting via Virtual Connect.

      Since the setting you’re looking for is more of a BIOS setting you could look into RBSU and/or conrep.

  3. HPDude HPDude

    A few updates for you.
    In the current version (as of this post V1.2) Credential parameters can be used as well as username and password. There are currently 117 cmdlets.
    The download link does work, there was a week or 2 during a transition to new web pages where it did not work. http://www.hp.com/go/PowerShell
    We also now have cmdlets for the Onboard Administrator for C3000 and C7000 blade enclosures.
    Other PowerShell support is in development.

Leave a Reply