HPE OneView
1827805 Members
2127 Online
109969 Solutions
New Discussion

Re: OneView Powershell Custom Report Available Fields

 
SOLVED
Go to solution
alfo
Occasional Visitor

OneView Powershell Custom Report Available Fields

I'm attempting to create a custom report from oneview using the powershell library, but it would appear that not all the information I'm looking to collect is available from Get-OVServer. Specifically a rakcmount server's location. In oneview it has a location listed as (for example) Rack_01-02, however that property and that value don't appear to be grabbed with Get-OVServer. When i run "Get-OVServer -ServerName [SERVERNAME] | Format-List" I get the following items:


type :
name :
serverName :
state :
stateReason :
assetTag :
capabilities :
category :
created :
description :
eTag :
formFactor :
generation :
hostOsType :
imlMode :
intelligentProvisioningVersion :
licensingIntent :
locationUri :
maintenanceMode :
memoryMb :
migrationState :
model :
modified :
mpFirmwareVersion :
mpHostInfo :
mpLicenseType :
mpModel :
mpState :
oneTimeBoot :
operatingSystem :
partNumber :
physicalServerHardwareUri :
platform :
portMap :
position :
powerLock :
powerState :
processorCoreCount :
processorCount :
processorSpeedMhz :
processorType :
refreshState :
remoteSupportSettings :
remoteSupportUri :
romVersion :
scopesUri :
serialNumber :
serverFirmwareInventoryUri :
serverGroupUri :
serverHardwareTypeUri :
serverProfileUri :
serverSettings :
shortModel :
signature :
status :
subResources :
supportDataCollectionState :
supportDataCollectionType :
supportDataCollectionsUri :
supportState :
supportTestEventState :
uidState :
uri :
uuid :
virtualSerialNumber :
virtualUuid :
ApplianceConnection :

Is there a way to get the Rack name that Oneview has through Get-OVServer?

1 REPLY 1
ChrisLynch
HPE Pro
Solution

Re: OneView Powershell Custom Report Available Fields

This information is stored in the Index, not the server hardware resource.  I have been meaning to add a custom property to the server hardware resource object for PowerShell.  For now, to get the location of a specific server, use the following:

# Get list of servers
$Servers = Get-OVServer

# Process the list of servers
ForEach ($server in $Servers) {

    $uri = "/rest/index/associations/resources?childUri={0}&associationName=RACK_TO_PHYSICAL_DEVICE" -f $server.uri
    
    Try {
        
        # Try to get the location from the index for the server.
        $Location = (Send-OVRequest -Uri $uri).members[0].parentResource.name

        Write-Host "Server " $server.name " is located in " $Location " rack"
    }

    Catch {

        Write-Error $_
    
    }

}
I work at HPE
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo