HPE OneView
1748169 Members
4122 Online
108758 Solutions
New Discussion

Powershell Question - Get-HPOVServer

 
SOLVED
Go to solution
Cottoc
Advisor

Powershell Question - Get-HPOVServer

@ChrisLynch I am hoping you can chime in on this one. Earlier today I was pulling some data in regards to my servers - Specifically a manager was interested in Proc Model/Cpu Count/Core Count. The Canned report within OneView 2.0 has the proc model, but not the CPU Count or the Core count....and I didnt want to deal with looking everything up individually.

So I turned to the handy PS Module you have built. I decided to use Get-HPOVServer. When I run the function by itself, the default properties that are returned are: Name, Status, Power, Serial Number, Model, ROM, iLO, Server Profile, License.

This is great, almost all the info I need to pass up to my manager - just missing the info on the Proc. So I pipe Get-HPOVServer to a Get-Member, and there I see a NoteProperty for processorType, processorCount, processorCoreCount....Perfect!

So I figure Ill just run

Get-HPOVServer | Select * | Export-Csv

do some filtering and pretty up the report, and be done with it. But...when I do this, I lose my property "Server Profile" - In fact, when I go back and look at my Get-Member from earlier...I dont even see a property for the Server Profile...just serverProfileUri. I'd wanted to hang onto it since I can use our profile naming convention to easily determine some info on the server itself (esxi vs windows etc)

How are you pulling this property when I just run the function Get-HPOVServer by itself? I may be blindly missing it - but I can't figure out where this is coming from. I managed to combine the output from running it as is, and running it with a select * in order to get it...but there has got to be a simple way that I am completely overlooking.

Or, if there is a recommendation on a smarter way of pulling this type of info I would love to hear it!

Thanks!

-Cottoc

2 REPLIES 2
ChrisLynch
HPE Pro
Solution

Re: Powershell Question - Get-HPOVServer

The Server Profile isn't actually a property of the Server Hardware resource object.  What is happening when you run Get-HPOVServer is a ScriptBlock is executing within the Server.format.ps1xml file (aka formats file).  The ScriptBlock is actually taking the serverProfileUri property value, passing to Send-HPOVRequest to then return the Server Profile object and only display the name property.

This behavior is based on the fact the library (and the REST API for that matter) only returns deflated resource objects.  Objects do have associations with each other, and they typically are in the form of a URI property; serverProfileUri in this case.  We are planning on providing a solution to this, but it will take a substantial amount of work to implement.

In the future, you can submit questions like this on the GitHub Issue Tracker, which isn't strictly for reporting issues.


I am an HPE employee

Accept or Kudo

Cottoc
Advisor

Re: Powershell Question - Get-HPOVServer

Awesome - That makes perfect sense.

Also -


In the future, you can submit questions like this on the GitHub Issue Tracker, which isn't strictly for reporting issues.


Thanks for the heads up on that - I was hesitant as I wasn't sure it was specifically and issue and more of just not understanding the inner workings of your code. Ill direct any future questions that way.

Thanks!

-Cottoc