Gather HP iLO information using PowerShell

Please begin by reading my previous post where I show how to retrieve physical hard disk information such as model numbers and firmware versions using the HP Insight Management WBEM providers.

A few days ago, as HP published an advisory regarding firmware of their Integrated Lights-Out (iLO) management controllers I wanted a way to collect this information from a number of servers. I created another CmdLet to retrieve information from two associated classes.
Namespace: root\hpq
Classes: HP_MPFirmware and HP_ManagementProcessor

For full details about the properties in these classes as well as the rest of the HP WBEM classes, download the latest version of the PDF document HP Insight Management WBEM Providers for Microsoft Windows Data Sheet

The Get-HPiLOInformation function

Update: Improved cmdlets available here

function Get-HPiLOInformation
 Retrieves iLO management controller firmware information
 for HP servers.
 The Get-HPiLOInformation function works through WMI and requires
 that the HP Insight Management WBEM Providers are installed on
 the server that is being quiered.
 .PARAMETER Computername
 The HP server for which the iLO firmware info should be listed.
 This parameter is optional and if the parameter isn't specified
 the command defaults to local machine.
 First positional parameter.
 Lists iLO firmware information for the local machine
 Get-HPiLOInformation SRV-HP-A
 Lists iLO firmware information for server SRV-HP-A
 "SRV-HP-A", "SRV-HP-B", "SRV-HP-C" | Get-HPiLOInformation
 Lists iLO firmware information for three servers
 [Parameter(Mandatory=$false, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, Position = 1)][string]$Computername=$env:computername)
 if ($pscmdlet.ShouldProcess("Retrieve iLO information from server " +$Computername)){
 $MpFirmwares = Get-WmiObject -Computername $ComputerName -Namespace root\hpq -Query "select * from HP_MPFirmware"
 ForEach ($fw in $MpFirmwares){
 $Mp = Get-WmiObject -Computername $ComputerName -Namespace root\hpq -Query ("ASSOCIATORS OF {HP_MPFirmware.InstanceID='" + $fw.InstanceID + "'} WHERE AssocClass=HP_MPInstalledFirmwareIdentity")
 $OutObject = New-Object System.Object
 $OutObject | Add-Member -type NoteProperty -name ComputerName -value $ComputerName
 $OutObject | Add-Member -type NoteProperty -name ControllerName -value $fw.Name
 Switch ($Mp.HealthState){
 5 {$stat = "OK"; break}
 10 {$stat = "Degraded/Warning"; break}
 20 {$stat = "Major Failure"; break}
 default {$stat = "Unknown"}
 $OutObject | Add-Member -type NoteProperty -name HealthState -value $stat
 $OutObject | Add-Member -type NoteProperty -name UniqueIdentifier -value $Mp.UniqueIdentifier.Trim()
 $OutObject | Add-Member -type NoteProperty -name Hostname -value $Mp.Hostname
 $OutObject | Add-Member -type NoteProperty -name IPAddress -value $Mp.IPAddress
 Switch ($Mp.NICCondition){
  {$stat = "OK"; break}
  {$stat = "Disabled"; break}
  {$stat = "Not in use"; break}
  {$stat = "Disconnected"; break}
  {$stat = "Failed"; break}
 default {$stat = "Unknown"}
 $OutObject | Add-Member -type NoteProperty -name NICCondition -value $stat
 $OutObject | Add-Member -type NoteProperty -name FirmwareVersion -value $fw.VersionString
 $OutObject | Add-Member -type NoteProperty -name ReleaseDate -value ($fw.ConvertToDateTime($fw.ReleaseDate))
 Write-Output $OutObject

Download hpilo.ps1 here

Example of the output:

PS C:\Windows\system32> Import-Module C:\MyPath\hpilo.ps1
PS C:\Windows\system32> Get-HPiLOInformation SRV-HP-A

ComputerName : SRV-HP-A
ControllerName : Integrated Lights Out 4 (iLO4)
HealthState : OK
UniqueIdentifier : ILOCZ123456AB
Hostname : SRV-HP-A-ILO
IPAddress :
NICCondition : OK
FirmwareVersion : 1.40
ReleaseDate : 2014-01-14 02:00:00

PS C:\Windows\system32

Newssource: Perhof


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s