The Hewlett Packard Enterprise iLO PowerShell cmdlets make it extremely easy to update iLO Firmware in mass. The Update-HPiLOFirmware cmdlet is an extremely handy for updating firmware across many systems. I particularly like this method because it fast, which isn’t always the case when trying to script upgrades. The syntax of the cmdlet is easy to remember and with Get-Help not far away, even if you forget the simple syntax, you can easily find the details. Combine the Update-HPiLOFimware functionality with the Find-HPiLO cmdlet used to discover and report iLOs using a network range and you have a winning combination to automate iLO firmware.
This method proved to be handy for me because I make a point to update iLO firmware prior to updating servers with a new Service Pack for ProLiant (SPP). Since I utilize the virtual media feature in iLO to deploy the SPP to ESXi nodes, I have found it is best to update iLO first and then let the SPP install all other firmware. If the iLO firmware is updated and it restarts during the SPP run, this causes the installer to fail because it lost its media.
Before you start
There are a couple quick things you’ll want to ensure before you start.
- You’ll need the HP iLO Toolkit. It is available here – http://www8.hp.com/us/en/products/server-software/product-detail.html?oid=5440657.
- Make sure you have a consistent admin credential for iLO. It makes updating multiple hosts much easier. The credential can be a local account in iLO or it can be an account from Active Directory if you have defined and setup AD integration on your iLOs.
- It is easiest to pass your credentials by variable using a PowerShell credentials object. You can do that easily with the Get-Credential cmdlet.
[code lang=”Powershell”]$ilocreds = Get-Credential[/code]
Alternatively, you can use the -username and -password switches on the Update-HPiLOFirmware cmdlet later.
Step-by-step
Working through the process step-by-step, you’d run the following commands to update firmware:
- The first step is to get a list of the servers using the Find-HPiLO cmdlet.
[code lang=”Powershell”]$servers = Find-HPiLO 192.168.200.1-255[/code]
- Next, you can investigate the current version of firmware on each iLO found with this simple Select and Sort statement.
[code lang=”Powershell”]$servers | Select HOSTNAME, PN, FWRI | Sort PN, FWRI [/code]
- Now that you’ve seen what the Find-HPiLO cmdlet returned, you can scope down the list to what you want to update. In this example, we are looking for firmware older than version 2.22 on iLO4 in teh Where statement. Confirm the output list of servers are the servers you wish to patch.
[code lang=”Powershell”]$servers | Where {$_.FWRI -lt 2.22 -AND $_.PN -like "*iLO 4*"} [/code]
- Repeat the scoped list and now pipe that into the Update-HPiLOFirmware cmdlet. This cmdlet need the credentials you setup earlier and it accepts the list of servers through the pipeline. The last switch needed is the location of the firmware file to load.
[code lang=”Powershell”]$servers | Where {$_.FWRI -lt 2.22 -AND $_.PN -like "*iLO 4*"} | Update-HPiLOFirmware -Credential $ilocreds -Location C:\firmware\ilo4\ilo4_222.bin[/code]
Condense it down
The same can be done as a one liner too – Find, Where (scope) and Update… You still need to set your credentials ahead of time.
[code lang=”Powershell”]Find-HPiLO 192.168.200.1-255 | Where {$_.FWRI -lt 2.22 -AND $_.PN -like "*iLO 4*"} | Update-HPiLOFirmware -Credential $ilocreds -Location C:\firmware\ilo4\ilo4_222.bin[/code]
HP PowerShell Toolkits
In addition to the iLO PowerShell toolkit, HPE also has sets of cmdlets to administer BladeSystem OnBoard Administrators and HP ProLiant BIOS settings. You may grab all three sets of cmdlets and find full documentation at http://www8.hp.com/us/en/products/server-software/product-detail.html?oid=5440657.