Create report on all servers in HPE OneView

In this post, I will share with you a script I use to run a report on all the HPE ProLiant servers added to our HPE OneView appliance(s).

Please note, in order for this script to work you will need to install the HPE OneView PowerShell module first. This module is linked to the version of your HPE OneView appliance(s). Assuming you keep your appliance up to date, the latest version at writing of this article is HPEOneView.660. You can install this module with this PowerShell command:

Install-Module -Name HPEOneView.660

More information on this module can be found here: GitHub – HewlettPackard/POSH-HPEOneView: PowerShell language bindings library for HPE OneView.

This script will connect with all HPE OneView appliances defined in variable $ListOfHPEOneViewAppliances. It will the following information of all servers added to the HPE OneView appliances:

  • Serial number
  • Name in HPE OneView
  • Server name
  • Server model
  • Server part number
  • Amount of memory
  • Processor type
  • Processor speed
  • Number of processors
  • Number of cores per processor
  • BIOS version
  • form factor
  • iLO model
  • iLO license type
  • iLO firmware version
  • iLO host name
## Source URL for HPWE OneView PowerShell modules:

# Load required PowerShell modules
#Install-Module -Name HPEOneView.660
$Modulename = 'HPEOneView.660'      # Module version must match the HPE OneView appliance version
If (-not (Get-Module -Name $ModuleName -ErrorAction SilentlyContinue)) {
    Import-Module $Modulename

$DateTime = $((Get-Date).ToString('yyyy-MM-dd_hh-mm-ss'))
$OutputPath = "$env:USERPROFILE\Documents\Reports\HPOneView"

If ( -Not (Test-Path -Path $OutputPath)) {
    New-Item -ItemType directory -Path $OutputPath

Set-Location $OutputPath
$Outputfile = "All-HPOneView-Servers-$DateTime"

# List of all HP OneView appliances
$ListOfHPEOneViewAppliances = (
    "<FQDN/IP address of HPE OneView server #1",

## Get credentials
$CredentialPrompt = "Please enter the username and password to connect with the HPE OneView server(s) : "
$Credentials = Get-Credential -Message $CredentialPrompt

## Connect to HP OneView appliances
ForEach ($HPOneViewAppliance in $ListOfHPEOneViewAppliances) {
    Connect-OVMgmt -Hostname $HPOneViewAppliance -Credential $Credentials

# Show a list of all connected HPE OneView servers

# Acquire server information
$HostReport = New-Object System.Collections.ArrayList
$ListOfServers = New-Object System.Collections.ArrayList

$ListOfServers = Get-OVServer -ApplianceConnection $ListOfHPEOneViewAppliances | Select-Object -Property *

Foreach ($Server in $ListOfServers) {
    Write-Host "Processing host" $Server.Servername

    $HostObject = New-Object -TypeName psobject

    $HostObject | Add-Member -MemberType NoteProperty -Name SerialNumber -Value $Server.SerialNumber # Serialnumber needs to be first for VLOOKUP to work in Excel
    $HostObject | Add-Member -MemberType NoteProperty -Name Name -Value $Server.Name
    $HostObject | Add-Member -MemberType NoteProperty -Name "Server Name" -Value $Server.ServerName
    $HostObject | Add-Member -MemberType NoteProperty -Name ServerModel -Value $Server.model
    $HostObject | Add-Member -MemberType NoteProperty -Name ProductNumber -Value $Server.partNumber
    $HostObject | Add-Member -MemberType NoteProperty -Name "RAM Count - Gb" -Value ($Server.memoryMB / 1024)
    $HostObject | Add-Member -MemberType NoteProperty -Name processorType -Value $Server.processorType
    $HostObject | Add-Member -MemberType NoteProperty -Name processorSpeedMhz -Value $Server.processorSpeedMhz
    $HostObject | Add-Member -MemberType NoteProperty -Name processorCount -Value $Server.processorCount
    $HostObject | Add-Member -MemberType NoteProperty -Name processorCoreCount -Value $Server.processorCoreCount
    $HostObject | Add-Member -MemberType NoteProperty -Name "BIOS version" -Value $Server.romVersion
    $HostObject | Add-Member -MemberType NoteProperty -Name formFactor -Value $Server.formFactor
    $HostObject | Add-Member -MemberType NoteProperty -Name iLOmodel -Value $Server.mpModel
    $HostObject | Add-Member -MemberType NoteProperty -Name iLOLicenseType -Value $Server.mpLicenseType
    $HostObject | Add-Member -MemberType NoteProperty -Name iLOFirmwareVersion -Value $Server.mpFirmwareVersion
    $HostObject | Add-Member -MemberType NoteProperty -Name "iLO host name" -Value $Server.mpHostInfo.mpHostName
    $HostObject | Add-Member -MemberType NoteProperty -Name "iLO IP name" -Value ($Server.mpHostInfo.mpIPaddresses | Where-Object { $_.address -like "*.*.*.*" } | Select-Object -ExpandProperty address)
    $HostObject | Add-Member -MemberType NoteProperty -Name "Source OneView appliance" -Value $Server.ApplianceConnection.Name

    $HostReport.add($HostObject) | Out-Null

$HostReport = $HostReport | Sort-Object Name
$HostReport | Export-Csv "$Outputfile.csv" -NoTypeInformation -UseCulture

# Housekeeping - let's disconnect the connected sessions
$ConnectedSessions | Disconnect-OVMgmt

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.

Leave a Reply

Your email address will not be published. Required fields are marked *