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).
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).
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:
You can display the full list of PowerShell HP cmdlets (110 cmdlets) as follows:
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:
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:
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.
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:
$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:
Get-HPiLOHostPower -Server $srvILO -Username $username -Password $password
As we can see, the server is on (HOST POWER : ON).
To turn the HP server on using the ACPI interface, run the command:
Set-HPiLOHostPower -Server $srvILO -Username $username -Password $password -HostPower "No"
You can switch on the server remotely as follows:
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:
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:
$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:
Get-HPiLOUIDStatus -Server $srvILO -Username $username -Password $password
Turn it on:
Set-HPiLOUIDStatus -Server $srvILO -Username $username -Password $password -UIDControl "Yes"
Now try to change the boot order of the server. Get information on the current settings of the boot priorities:
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:
Set-HPiLOOneTimeBootOrder -Server $srvILO -Username $username -Password $password -Device "CDROM"
Mount the necessary iso image to the virtual CDROM:
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:
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.