ilo rest configuration

Administrate multiple servers remotely HP ILO

Hey guys !

After writing the basics on how to use the RESTful interface tool, (the tool that allows you to manage your HP servers by command line) we will now be able to script with this tool. So that we can configure as many servers as we want in one click.

To do this, we’ll create a .bat file (in this example, I’ll use the same configurations as I did in the previous article).


cd "C:\Program Files\Hewlett Packard Enterprise\RESTful Interface Tool"

for /F %%i in (hosts.txt) do (

ilorest.exe login %%i -u administrator -p password --select snmp
ilorest.exe set "ReadCommunities=[public]" --commit
ilorest.exe set "TrapCommunities=[public]" --commit
ilorest.exe set "AlertDestinations=[192.x.x.x]" --commit


Here, we can see in the script that we are going to start the RESTful tool and then we run our commands one after the other (we’ll have to think about hiding the password because it’s in clear in the file for the moment or simply ask for it as a prompt). All this in a for loop in the hosts.txt file, nothing very complicated (if you have installed ilorest in a non-default directory, modify the script otherwise you may have problems…).

Now we need to create a hosts.txt file that will contain the name of our hosts.


We save our hosts.txt file (Be careful, depend on where you save it, you may have to modify the script).

Now that everything is recorded, you can launch your script.bat, and here are all the SNMP parameters should be configured on your servers! Wasn’t that easy? If you have any questions don’t hesitate.


Here’s a gift, here is the powershell version of script.bat (if you’re more familiar with powershell)

This script is a bit more advanced because it is useful if your versions of ILO are not compatible with ILOREST, that is to say that the script will create a valid.txt file and inform the server in it each time it finds a valid host and automatically skip the others.

There’s even a progress bar, woow

cd "C:\Program Files\Hewlett Packard Enterprise\RESTful Interface Tool"

$hosts = Get-Content hosts.txt 
Remove-Item –path .\valid.txt
$ErrorActionPreference = "silentlycontinue"
#$ErrorActionPreference = "continue"

foreach ($h in $hosts){

$h = $h -replace '\s',''
echo "`nTrying to connect to $h"

Write-Progress -Activity “Applying config” -status “Working on $h...” -percentComplete ($i / $hosts.count)

$cmd_out = ./ilorest.exe login $h -u administrator -p password --select snmp 

./ilorest.exe set "ReadCommunities=[public]" --commit | Out-Null
./ilorest.exe set "TrapCommunities=[public]" --commit | Out-Null
./ilorest.exe set "AlertDestinations=[]" --commit | Out-Null

    if ($cmd_out[3] -match "Done")

    echo "$h is a valid host`n"
    Add-Content valid.txt $h
    echo "`nConfiguration complete"

    echo "$h is not a valid host`n"



Now just try, and create your own scripts, do not hesitate to share them 🙂

2 thoughts to “Administrate multiple servers remotely HP ILO”

  1. Hey,It’s a pity you don’t have a donate button! I’d most certainly donate to this outstanding blog! I guess for now i’ll settle for bookmarking and adding your RSS feed to my Google account. I look forward to new updates and will talk about this website with my Facebook group. Talk soon! danke

Leave a Reply

Your email address will not be published. Required fields are marked *