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:
$env:PSModulePath+=";$env:ProgramFiles\Hewlett-Packard\PowerShell\Modules"
You can display the full list of PowerShell HP cmdlets (110 cmdlets) as follows:
Get-Command *HP*
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:
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:
Find-HPiLO 10.100.200.138
Find-HPiLO 10.100.200.138-141
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.
8 comments
Very nice stuff. I can’t want to get a demo of this in person…. or video – do you have a video demo of this?
Again – it looks great.
Cheers!
Jeffrey Snover[MSFT]
Distinguished Engineer and Lead Architect for Windows Server and System Center
What do you want to see on this video?
Screenshots are made in the productive environment – all so clear…
I liked your post on the HP tools for ILO. I have two requests / Questions.
1. I ran the Find-HPiLO then IP address range. It executes says it may take a while but then does nothing and finds nothing. Suggestions?
2. I need to turn ILO on for maybe half our environment, add a user and password for the boxes in ILO and finally give it an ILO IP address. Even if in baby steps; do you have powershell scripts for this?
Thanks,
Remember these PoSh cmdlets work only with HP iLO v3 and v4…
1. Try to run Find-HPiLO from the same subnet, which contains ILO interfaces.. The problem persists?
2. You can’t change ILO IP address using cmdlet Add-HPiLOUse.
please can we have a script to reset the password for ‘x’ number of servers and then create a new user on each servers with a standard password
Hi I need to create a common account to multiple ILOs with below access , can someone please assist me on that .
1).I have a notepad file with list of ILOs that needs a new account created in all the ILOs , a common username and password needs to be used
Hi Team,
We usually use a jump box server to login to other ILO machines for troubleshooting.
I want to use this to fetch the Server logs and other health related data.
Where shall I install it in Jump box ?
Thanks.
You must download and install module “HP Scripting Tools for Windows PowerShell” on your jump box server