Gather HP iLO information using PowerShell

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
{
    <#
    .SYNOPSIS
    Retrieves iLO management controller firmware information
    for HP servers.

    .DESCRIPTION
    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.

    .EXAMPLE
    Get-HPiLOInformation
    Lists iLO firmware information for the local machine

    .EXAMPLE
    Get-HPiLOInformation SRV-HP-A
    Lists iLO firmware information for server SRV-HP-A

    .EXAMPLE
    "SRV-HP-A", "SRV-HP-B", "SRV-HP-C" | Get-HPiLOInformation
    Lists iLO firmware information for three servers

    #>
    [CmdletBinding(SupportsShouldProcess=$true)]
    Param(
    [Parameter(Mandatory=$false, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, Position = 1)][string]$Computername=$env:computername
    )

    Process{

        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){
                    2 {$stat = "OK"; break}
                    3 {$stat = "Disabled"; break}
                    4 {$stat = "Not in use"; break}
                    5 {$stat = "Disconnected"; break}
                    6 {$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 : 192.168.0.201
NICCondition : OK
FirmwareVersion : 1.40
ReleaseDate : 2014-01-14 02:00:00

PS C:\Windows\system32

10 thoughts on “Gather HP iLO information using PowerShell

  1. The Get-HPiLOInformation function works through WMI and requires that the HP Insight Management WBEM Providers are installed on the server that is being queried.

    In our environment, the above package is not installed, so can’t get the command “Get-HPiLOInformation” executed. Is there any other way, from where we can get the information.

  2. I am getting below output.. Please help

    Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
    At C:\hpilo.ps1:46 char:42
    + $MpFirmwares = Get-WmiObject <<<< -Computername $ComputerName -Namespace root\hpq -Query "select * from HP_MPFirmware"
    + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

    Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
    At C:\hpilo.ps1:48 char:36
    + $Mp = Get-WmiObject <<<< -Computername $ComputerName -Namespace root\hpq -Query ("ASSOCIATORS OF {HP_MPFirmware.InstanceID='" + $f
    w.InstanceID + "'} WHERE AssocClass=HP_MPInstalledFirmwareIdentity")
    + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

    You cannot call a method on a null-valued expression.
    At C:\hpilo.ps1:62 char:115
    + $OutObject | Add-Member -type NoteProperty -name UniqueIdentifier -value $Mp.UniqueIdentifier.Trim <<<< ()
    + CategoryInfo : InvalidOperation: (Trim:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\hpilo.ps1:77 char:107
    + $OutObject | Add-Member -type NoteProperty -name ReleaseDate -value ($fw.ConvertToDateTime <<<< ($fw.ReleaseDate))
    + CategoryInfo : InvalidOperation: (ConvertToDateTime:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    ComputerName : ESXHost
    ControllerName :
    HealthState : Unknown
    Hostname :
    IPAddress :
    NICCondition : Unknown
    FirmwareVersion :

  3. Hi Perhof,

    I have got the information from the below code for HP iLO’s and now trying similar kind of information for IBM physical servers, which has IMM (integrated Management Module) Firmware version

    By ESXi command line, we can find that information through “SMbiosDump | grep -i Integrated”

    ********************************************************************************************************

    ## Script function: quickly get BIOS date, Smart Array FW version, and iLO FW version for HP hosts in a given location (folder, cluster, datacenter, etc.)
    ## Author: vNugglets.com — Sep 2011

    ## folder in which hosts in which we are interested reside
    #$strHostsFolderName = “myFolder”
    #Get-View -ViewType HostSystem -Property Name, Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo -SearchRoot (Get-View -ViewType Folder -Property Name -Filter @{“Name” = “^$([RegEx]::escape($strHostsFolderName))$”}).MoRef | %{
    ## cluster in which hosts in which we are interested reside
    $strHostsClusterName = “myCluster”
    Get-View -ViewType HostSystem -Property Name, Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo -SearchRoot (Get-View -ViewType ClusterComputeResource -Property Name -Filter @{“Name” = “^$([RegEx]::escape($strHostsClusterName))$”}).MoRef | %{
    $arrNumericSensorInfo = @($_.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo)
    # HostNumericSensorInfo for BIOS, iLO, array controller
    $nsiBIOS = $arrNumericSensorInfo | ? {$_.Name -like “*System BIOS*”}
    $nsiArrayCtrlr = $arrNumericSensorInfo | ? {$_.Name -like “HP Smart Array Controller*”}
    $nsiILO = $arrNumericSensorInfo | ? {$_.Name -like “Hewlett-Packard BMC Firmware*”}
    New-Object PSObject -Property @{
    VMHost = $_.Name
    “SystemBIOS” = $nsiBIOS.name
    “HPSmartArray” = $nsiArrayCtrlr.Name
    “iLOFirmware” = $nsiILO.Name
    } ## end new-object
    } ## end Foreach-Object

    ********************************************************************************************************

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s