In this post, I would like to share with you a PowerShell script I use to update the iLO firmware version of multiple HPE ProLiant servers
During my research on how to update the firmware version of the iLO of a HPE ProLiant server, I used code from the following web sites:
https://www.vgemba.net/microsoft/powershell/Update-HPE-iLO-Firmware/
https://dailysysadmin.com/KB/Article/4039/update-your-hpe-ilo-device-firmware-using-powershell/
This script uses the HPEiLOCmdLets PowerShell Module, which can be installing using this PowerShell command:
1 | Install-Module -Name HPEiLOCmdLets |
Before running this script (I suggest you try it on 1 server first ), first update these variables:
- $iLO4_FirmwareVersion
- $iLO4_FirmwareFile
- $iLO5_FirmwareVersion
- $iLO5_FirmwareFile
- $iLO_Range
These should reflect the latest firmware versions and files for the iLO4 (HPE ProLiant Gen8/9) and the iLO5 (HPE ProLiant Gen10).
Variable $iLO_Range must reflect the IP address range of the iLO’s you want to update. If you just want to update 1 iLO, enter the value as ‘10.10.10.50-50’.
The values in the script below are examples only and need to be changed to your environment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # Load module HPEiLOCmdlets $ModuleName = 'HPEiLOCmdlets' If ( -not ( Get-Module -Name $ModuleName -ErrorAction SilentlyContinue)) { Import-Module $Modulename } ### Variables section ### # iLO 4 variables $iLO4_Type = 'Integrated Lights-Out 4 (iLO 4)' $iLO4_FirmwareVersion = '2.80' $iLO4_FirmwareFile = '\\<servername>\<share name>\Firmware\iLO4\ilo4_280.bin' # iLO 5 variables $iLO5_Type = 'Integrated Lights-Out 5 (iLO 5)' $iLO5_FirmwareVersion = '2.71' $iLO5_FirmwareFile = '\\<servername>\<share name>\Firmware\iLO5\ilo5_271.fwpkg' ## Define IP range $iLO_Range = '10.10.10.50-60' # iLO credentials $Credential = Get-Credential -Message "Please enter the username and password used for connecting with the iLO's:" # Get information from all iLO's $iLO_Info = Find-HPEiLO -Range $iLO_Range # Find iLO's with an outdated firmware version and update them Clear-Host $iLO_info | ForEach-Object { If ( $_ .PN -eq $iLO4_Type ) { If ( $_ .FWRI -ne $iLO4_FirmwareVersion ) { $Connection = Connect-HPEiLO -IP $_ .IP -Credential $credential -DisableCertificateAuthentication If ( $Connection ) { Write-Host 'A connection has been made with the iLO of server ' $_.Hostname Write-Host ' Starting firmware update... ' Update-HPEiLOFirmware -Connection $Connection -Location $iLO4_FirmwareFile -Confirm:$false Write-Host ' Finished with firmware upgrade. Let '' s check the current version... ' $1 = (Find-HPEiLO -Range $_.IP).FWRI If ($1) { Write-Host ' The iLO firmware version of server ' $_.Hostname ' is: ' $1 } Write-Host Disconnect-HPEiLO -Connection $Connection -InformationAction Ignore Start-Sleep -Seconds 10 Write-Host ' ************************************************************************************* ' } } Else { Write-Host Write-Host ' The iLO firmware of server '$_.Hostname' is already at version '$iLO4_FirmwareVersion Write-Host } } ElseIf ($_.PN -eq $iLO5_Type) { If ($_.FWRI -ne $iLO5_FirmwareVersion) { $Connection = Connect-HPEiLO -IP $_.IP -Credential $credential -DisableCertificateAuthentication If ($Connection) { Write-Host ' ************************************************************************************* ' Write-Host ' A connection has been made with the iLO of server ' $_.Hostname Write-Host ' Starting firmware update... ' Update-HPEiLOFirmware -Connection $Connection -Location $iLO5_FirmwareFile -Confirm:$false Start-Sleep -Seconds 15 Write-Host ' Finished with firmware upgrade... ' Disconnect-HPEiLO -Connection $Connection -InformationAction Ignore Write-Host ' ************************************************************************************* ' } } Else { Write-Host Write-Host ' The iLO firmware of server '$_.Hostname ' is already at version' $iLO5_FirmwareVersion Write-Host } } } # ******************************************************************* |
As always, please keep in mind this script is tailored to my environment but can be used as a template for your environment. I do not pretend to be a PowerShell guru and as such my script may not be perfect. I am open to suggestions, though
If you found this script useful, I’d appreciate it if you leave a comment.