- Community Home
- >
- Software
- >
- HPE OneView
- >
- Custom Report -> HPE API and/or PowerShell
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 06:52 AM
04-19-2021 06:52 AM
Hello - sucessfully pull in all server hardware using API, but the request now is to add the enclosure rack location as a column on the blade server report.
Since I can't create a custom report within OneView (we don't have global and won't be getting it), is there a way to create a custom report using the powershell commandlets?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 11:04 AM
04-19-2021 11:04 AM
Re: Custom Report -> HPE API and/or PowerShell
OneView Global Dashboard is a no-cost product that any OneView customer is entitled to download and use.
Rack information is an Index resource. So, to get the rack information of servers, you can use the following to get the rack name associated with the server resource:
# Index base URI
$baseUri = '/rest/index/associations?name=RACK_TO_PHYSICAL_DEVICE&childUri={0}'
# Get list of rack mount servers
$Servers = Get-OVServer | Where { $null -eq $_.locationUri }
ForEach ($server in $Servers) {
$uri = $baseUri -f $server.uri
# Get the resource association
$indexResource = Send-OVRequest -Uri $uri
# Get the rack
$associatedRack = Send-OVRequest -Uri $indexResource.members[0].parentUri
Write-Host $server.name "is associated with" $associatedRack.name
}
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 11:23 AM - edited 04-19-2021 11:44 AM
04-19-2021 11:23 AM - edited 04-19-2021 11:44 AM
Re: Custom Report -> HPE API and/or PowerShell
Thanks @ChrisLynch ! Oddly that doesn't provide any output for me. It doesn't error and does finish, but nothing in the console.
My pre-req command was just using Connect-OVMgmt to connect to my oneview appliance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 12:02 PM
04-19-2021 12:02 PM
SolutionThe code filters out BL and SY servers from the appliance. Both of which have a different method of obtaining the rack information. This code would work for those types of devices:
# Index base URI
$baseUri = '/rest/index/associations?name=RACK_TO_PHYSICAL_DEVICE&childUri={0}'
# Get list of rack mount servers
$Servers = Get-OVServer | Where { $null -ne $_.locationUri }
ForEach ($server in $Servers) {
# The locationUri value is the Enclosure resource's URI
$uri = $baseUri -f $server.locationUri
# Get the enclosure resource only for reporting purposes
$enclosureResource = Send-OVRequest -Uri $server.locationUri
# Get the resource association
$indexResource = Send-OVRequest -Uri $uri
# Get the rack
$associatedRack = Send-OVRequest -Uri $indexResource.members[0].parentUri
"{0} is associated with {1} enclosure, associated with {2} rack" -f $server.name, $enclosureResource.name, $associatedRack.name | Write-Host
}
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 12:37 PM