≡ Menu

Change HP ILO User password using PowerShell

In this post, I will take you through a PowerShell script that helps in setting up the password for HP Integrated Lights-Out (ILO) console.

All these years, I was under kind of wrong impression that HP ILO can be managed via web console and a few utilities given by HP. Today I realized that it can also be managed using other protocols like SSH and Telnet. The moment I learned about it, I started thinking how can I leverage this and automation HP ILO user account change process.

After a bit of Googling, I came across a nice document from HP that gives all you need for managing HP ILO via SSH, telnet, web, and other HP utilities. You can download a copy of “HP iLO2 Scripting and Command line Guide” from HP website (click here).

I authored below quick script after going through the document. The script replies on a utility called plink(click here to download) which you should download and place in System path to make this script work. Using plink.exe, the script creates a SSH connection to HP ILO IP/Name. This utilities takes username and password required for the ILO connection and then changes the password of the account your specified to the key you want.



$ILOcmd = [String]::Format('{0} {1}@{2} -pw "{3}" "set /map1/accounts1/{4} password={5}" 2>&1',            

try {            
 [array]$Output = Invoke-Expression $ILOcmd -ErrorAction Stop            
 if($Output.Count -lt 2) {            
  Write-Host "Failed to set ILO password. `nLastExitCode : $LASTEXITCODE`nResult : $Output"            

} catch {            
 Write-Host "Failed to set ILO password. `nLastExitCode : $LASTEXITCODE`nResult : $Output"            

if($LASTEXITCODE -eq 0 -and $Output[1].Split("=")[1] -eq 0) {            
 Write-Host "Password set successfully. `nLastExitCode : $LASTEXITCODE`nResult : $Output"            
} else {            
 Write-Host "Failed to set password. `nLastExitCode : $LASTEXITCODE`nResult : $Output"            


In the below example, I am creating SSH connection to HP ILO of host1 with a user name called Administrator and setting password for user account myilouser1. Please note that you need to pass ILO name or IP address of target host to ILOHostName parameter.

.\Set-ILOUserPassword.ps1 -ILOHostName host1ILO -ILOLoginUser administrator -ILOLoginUserpwd mypass -ILOUser myilouser1 -ILOUserpwd user1pwd -PlinkPath c:\temp\plink.exe

This is a simple script I have written to demonstrate that HP ILO password can be set easily using PowerShell. I request you to test the script properly in test/lab environment before trying in production. You can use this script by modifying a bit to create users, delete users etc. Please refer to the aforementioned HP documentation for examples on how to do variety of actions using SSH connection.

Hope this helps.

Comments on this entry are closed.

  • Francois-Xavier Cat March 13, 2013, 11:29 pm

    Nice Post!
    I will give it a try.

  • Dave October 17, 2015, 3:48 am

    This almost works, but I think you need a response to the question “Store Key in cache” I did this in a plain DOS batch file pre-pending the command line with “echo n |”. Worked fabulously. Thanks for the idea and command structure for using Plink!

    • TechiBee October 17, 2015, 7:44 am

      Thats a good catch. echo n| or echo y| is needed when SSH prompts SSH key storage. Can you post the modified command you have used for future readers?