cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Get friendly names for processors

906
Views
1
Helpful
0
Comments
Cisco Employee

Whether you use PowerShell to pull inventory information from Cisco UCS Manager or from VMware vCenter or from Microsoft SCOM, you will find those tools just report the processor name exactly as Intel or AMD display them. I find those strings to be unfriendly if you want to display them for a user or perform any further processing on them.

They look like this:

Intel(R) Xeon(R) CPU E7- 2860  @ 2.27GHz

Intel(R) Xeon(R) CPU E7-L8867  @ 2.13GHz

Intel(R) Xeon(R) CPU E5-2650L 0 @ 1.80GHz

Intel(R) Xeon(R) CPU E5-2643 0 @ 3.30GHz

Intel(R) Xeon(R) CPU E7- 4850  @ 2.00GHz

Intel(R) Xeon(R) CPU E5-2440 0 @ 2.40GHz

Intel(R) Xeon(R) CPU E5-2695 v2 @ 2.40GHz

Intel(R) Xeon(R) CPU           X5687  @ 3.60GHz

Intel(R) Xeon(R) CPU           E5540  @ 2.53GHz

Take a look at the list above and notice all the irregularities:

  1. The E7 processors have a space after the dash and the E5 processors do not.

  2. The E5 processors have a zero between the model name and the speed.

  3. The Westmere/Nehalem processors have a lot of spaces between the word CPU and the model name.

  4. Second generation E5 processors have "v2" after the model name.

In addition to these irregularities, you likely don't need the words Xeon or CPU or the speed of the processor.

How do we make the ugly list above look like the list below?

Intel E7-2860

Intel E7-L8867

Intel E5-2650L

Intel E5-2643

Intel E7-4850

Intel E5-2440

Intel E5-2695 v2

Intel X5687

Intel E5540

It's all done with regular expressions in PowerShell. If you're not already familiar, a regular expression is a very powerful search mechanism that can appear very intimidating to the uninitiated. Luckily, I've written a function called Get-FriendlyProcName that takes care of the all of the complicated searching and replacing for you. You can provide it a single argument or give it pipeline input like this:

Get-FriendlyProcName "Intel(R) Xeon(R) CPU E5-2695 v2 @ 2.40GHz"

-- or --

Get-UcsBlade | Get-UcsComputeBoard | Get-UcsProcessorUnit -Id 1 | select Model | Get-FriendlyProcName

The function will convert both Intel and AMD processor names into something more readable. If you run it in -verbose mode, you will get additional feedback. Try it out!

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards
This widget could not be displayed.