Using HP iLO Scripting Tools for Windows #PowerShell MT @GetScripting podcast @PowerScripting

PS:> Get-Podcast |? {($_.Name -eq “Get-Scripting” -or $_.Name -eq “PowerScripting”)} | % Get-HPiLO | Format-Audio

hp-get-scripting-ilo-logo2

Have you ever looked for an item that you set down somewhere and you just can’t find it despite a good thorough search? Then later (once you’ve given up), you practically trip on that very item or it just comes and hits you right in the head! Serendipity is quite a thing!

A lot of the cool tools (i.e. solutions to challenges) come to me in a similar way. Often times via an unexpected tweet, podcast, webinar or a face to face encounter I discover a ‘new to me’ resource that can be leveraged to accomplish a particular task that I’ve been mulling over.

It happened again the other night on the way home after some late night vBrownBag LATAM prep work. I was catching up on my holiday backlog of podcasts. As I drove I listened to Episode 37 (Jingle Bells edition) of the Get-Scripting Podcast hosted by AlanRenouf and JonathanMedd.

[Update]: In the time between when I drafted this post and when I am publishing it, the same topic was also discussed on another podcast that I listen to. Not only was it mentioned in Episode 259 of the PowerScripting Podcast hosted by Jonathan Walz and Hal Rottenberg, the guest was in fact the creator of the tool, Jeff Galloway from HP (bonus: the first segment of this episode captures some awesome DSC tech chat).

Jeff along with his intern developed and released the HP Scripting Tools for Windows PowerShell Configuration cmdlets for iLO3 and iLO4 available for download at http://hp.com/go/powershell.

A bit of  quick Googling showed that @ShayLevy has posted some notes along with a link to the  21-page user guide and @RuddyVCP wrote a post about the same topic. (Surely there are others, see note at end).

So, what problems does this solve?
Earlier in the week I had a customer ask if I knew of some way to perform a particular configuration task on HP servers that currently required they perform a host powercycle to boot from a utility ISO. Since it was a VMware ESXi host I suggested the use of HP’s provided esxcli extensions, though they do require you to either have installed the vendor specific custom ESXi ISO (Do you BTW?) or add the individual VIBs to the host, which can be done via interactive installation of the offline bundle(s) or slipped into your own custom built image. With the tools in place, one could even use the Get-EsxCLI() ‘trick’ to interact with the HP utility from PowerShell/PowerCLI, if that’s how you roll. Regardless, it required something the customer didn’t already have in place and would have to add to each host in order to use it.

Hearing about these new HP iLO Scripting Tools for Windows PowerShell made me think that this customer could potentially leverage them to perform the task they needed to do without having to install anything on their hosts.

These HP Cmdlets open up a lot of possibilities and makes them readily accessible from within a familiar PowerShell environment. There are 110 Cmdlets including a number of Get-properties, based on the results one which one could then take another action such as; Set-x, Reset-x, Start, Clear, Disable, Mount, etc.

What can it do?

A very simple example would be to search for servers with iLO on a particular subnet or IP range and then retrieve the status of each.

In a Test/Dev lab with several G7 and G8 servers this simple script was a quick way to check the status of all of them in one quick pass.

$usr=”top”
$pass=”secret”
$iLoSubnet=”10.0.1.6-9″
$iloIP=Find-HPiLO $iLoSubnet|Select IP
Get-HPiLOVMStatus -Server $iloIP -user $usr -pass $pass|Select Hostname, Status_Message

get ilo status

What else can it do?

Another simple workflow might be to discover iLO, Mount an ISO, set onetime boot media, and then issue a power on or reset to initiate an OS installation.

$usr=”top”
$pass=”secret”
$iLoSubnet=”10.0.1.6-9″
$iloIP=Find-HPiLO $iLoSubnet|Select IP
$isourl =”http://webserver.lab/dir/provstart.iso

Dismount-HPiLOVirtualMedia -Server $iloIP -user $usr -pass $pass -Device CDROM
Mount-HPiLOVirtualMedia -Server $iloIP -user $usr -pass $pass -Device CDROM -ImageURL $isourl

Get-HPiLOOneTimeBootOrder -Server $iloIP -user $usr -pass $pass | Select BOOT_TYPE
Set-HPiLOOneTimeBootOrder
-Server $iloIP -user $usr -pass $pass -Device “CDROM”

Get-HPiLOHostPower -Server $iloIP -user $usr -pass $pass
Set-HPiLOHostPower -Server $iloIP -user $usr -pass $pass -HostPower “Yes”

Dismount-HPiLOVirtualMedia -Server $iloIP -user $usr -pass $pass -Device CDROM

Although we are not necessarily using the Host Power off ( i.e. “No”) option in this example, it may prudent to observer that there is a note in the user guide that explains:
“Whether a server turns off or not when using Set-HPiLOHostPower depends on the operating system power button setting and state of the system. The operating system may ignore a power off request using this command.
To force power off, use the Set-HPiLOVirtualPowerButton cmdlet with parameter –PressType HOLD.

Tying these pieces together, these steps could be integrated as part of a bare-metal deployment in which, your boot media were used to kick off a (fully automated) OS install process.

What’s holding you back? 

How might you use these tools in your environment?
Let others know by leaving a comment, tweet or blog post, I’ll gladly add a link to it right here.

Some final notes:

You may have noticed above that rather than piping the results of a find-hpilo into get-hpilo cmdlet I had to use a variable. This is because for some reason the object(s) returned from the find cmdlt are somehow not consumable by get-hpilo so instead I grabbed the IP(s) and used that in place. This is something that  @RuddyVCP noted in his post about the same topic. Mr. Ruddy also pointed out that he hopes (as do I) that HP plans on leveraging the standard PowerShell credential parameters in a future release instead of forcing a username/password with each use of the cmdlet. In the Power-Scripting interview, Jeff stated that his manner of handling credentials was a design decision that was made in consideration of the fact that iLO can actually perform its own authentication against LDAP / Active Directory. Supporting both would be ideal.

Regardless of these small issues, these new HP supported PowerShell cmdlets are much easier and every bit as powerful as using the HP RIBCL for scripting iLO operations from Windows OS. Don’t believe me? Have a look here: http://youtu.be/LOqKVHrohj0 (Makes you want to hug Jeff & his intern, doesn’t it!).

I won’t spoil the entire podcast episode for you, but if you do give it a listen you’ll hear about a few additional enhancements to be released in version 1.1, hopefully coming out in early March. When it does, I’ll do my best to get another post out or update this one.

PowerShell or PowerCLI Fanboy?

If you are, then you might have noticed the logos I cobbled into the image above. Thank Alan for providing these cool logos to the community in full res downloadable format on his website.

If you didn’t catch the inline links above, I can’t recommend these podcasts enough: