Posted on June 2, 2014 · Posted in Powershell

HP ILO Management Using PowerShell

Recently Hewlett-Packard has issued a set of 110 PowerShell cmdlets allowing Windows administrators and IT professionals to remotely configure and manage HP ILO interfaces on HP servers from Windows systems. This set of cmdlets is called HP Scripting Tools for Windows PowerShell and designed to work with HP iLO 3 and iLO 4. The cmdlets are united into HPiLOCmdlets module and meant for:

  • Search and scan ILO interfaces in the network
  • Access to ILO settings, including: ip settings, ILO users, power management, logs, IML, etc.
  • Ability to manage several iLO boards simultaneously

You can download HP Scripting Tools for Windows PowerShell here. Choose the version and bitness of your system (Windows 7 SP1, Microsoft Windows 8, Microsoft Windows Server 2008 R2 SP1 and Microsoft Windows Server 2012 /R2 are supported) and download the corresponding package (by the time this article had been written, HP Scripting Tools Version 1.1 – 20 Mar 2014 was available).

manage hp ilo cards with powershell

In our example it is the package for Windows Server 2012 R2 –Z7550-10537-x64.exe (479 KB). Unpack the contents into any folder and start the installation of HP Scripting Tools for PowerShell (HPiLOCmdlets-x64.msi).

Note. To make the cmdlets work, you should have Microsoft Management Framework 3.0 (with PowerShell 3.0) or Microsoft Management Framework 4.0 (PowerShell 4.0) installed on your computer. PoSh 3.0 also needs .NET 4.0 to be installed, and PoSh 4.0 – NET 4.5.

The module is installed to C:\ProgramFiles\Hewlett-Packard\PowerShell\Modules folder, but the path to this directory is not indicated in the system variable PSModulePath. So, by default, PowerShell does not see this module. Let’s fix that with the following command:

1
$env:PSModulePath+=";$env:ProgramFiles\Hewlett-Packard\PowerShell\Modules"

Tip. This change is valid only in the current PowerShell session.

You can display the full list of PowerShell HP cmdlets (110 cmdlets) as follows:

1
Get-Command *HP*

full list of hp ilo cmdlets

Using these cmdlets, you can get the status and manage a lot of ILO board settings on the HP servers: e. g., manage power supply, booting order, UID light, obtain information on the HP ILO version, update firmware, etc.

You can get the information on the meaning, arguments and samples of any cmdlet usage by running the following command:

1
help  -Full

Firstly, let’s introduce the cmdlet that allows to find HP ILO interfaces in the network. It can take both an actual IP address and a range of IP addresses as an argument:

1
Find-HPiLO 10.100.200.138
1
Find-HPiLO 10.100.200.138-141

Powershell - network scan hp ilo cards

In our example, when scanning the range of IP addresses, we found 3 interfaces of ILO v3 installed on HP Proliant DL 360 G7 servers.

Note. You won’t be able to specify the DNS name in the command, because the cmdlet doesn’t support the name resolution.

Not to specify it each time, let’s store ILO IP address, name and password of the user, who has access to the ILO console, in the corresponding variables:

1
2
3
4
5
$srvILO = Find-HPiLO 10.100.200.141
 
$username='Admin'
 
$password='ILOPa$w0rd'

Let’s try to find out if the power on the server is on:

1
Get-HPiLOHostPower -Server $srvILO -Username $username -Password $password

 hp ilo board : get status posh

As we can see, the server is on (HOST POWER : ON).

To turn the HP server on using the ACPI interface, run the command:

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

powershell - turn on power on hp servers

You can switch on the server remotely as follows:

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

Let’s write a small script that takes the settings from a CSV file and switches all HP servers on the list on/off.

The CSV file contains IP address of a server, user name and password, necessary power status on the server. The format of the ILO.csv  file is:

1
2
3
Server,Username,Password,HostPower
10.100.200.160,Admin, ILOPa$w0rd,Yes
10.100.200.162,Admin, someILOword,No

The next PoSh script follows this list and switches power supply of all servers on or off as necessary:

1
2
3
4
5
6
$path = ".\ILO.csv"
$file_csv = Import-Csv $path
$p_ilo = Set-HPiLOHostPower -Server $file_csv.Server -Username $csv.Username -Password $file_csv.Password -HostPower $file_csv.HostPower
$p_ilo | Format-List
$p_ilo = Get-HPiLOHostPower -Server $file_csv.Server -Username $file_csv.Username -Password $file_csv.Password
$p_ilo | Format-List

Now let’s try to remotely switch on the UID control (blue) on the server. Firstly, find out the current UID control status:

1
Get-HPiLOUIDStatus -Server $srvILO -Username $username -Password $password

Turn it on:

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

powershell turn off/ turn on UID on HP servers

Now try to change the boot order of the server. Get information on the current settings of the boot priorities:

1
Get-HPiLOOneTimeBootOrder -Server $srvILO -Username $username -Password $password

Let’s change the boot order of the HP server, having specified a CDROM as the first device to boot from:

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

hp server manage boot order with powershell

Mount the necessary iso image to the virtual CDROM:

1
Mount-HPiLOVirtualMedia -Server $srvILO -user $srvILO -pass $password -Device CDROM -ImageURL ‘http://isosrv1.woshub.com/iso/windows2012r2.iso’

You can dismount the image as follows:

1
Dismount-HPiLOVirtualMedia -Server $srvILO -user $srvILO -pass $ password -Device CDROM

We have considered only basic examples of using the HPiLOCmdlets module, but as you can already notice, the set of cmdlets HP Scripting Tools for Powershell can make the tasks of a system administrator much simpler allowing to automate everyday tasks while working with HP servers.

Previous:
Next:
Related Articles