Querying Dell PowerEdge RAID Controllers (PERC) using PowerShell

Like my recent post on installing fonts using PowerShell, queryin­­g a Dell PowerEdge RAID Controller (PERC) is something I have looked at, abandoned, gone back to, googled, looked at, and abandoned again so many times I have lost count. The problem is there is still no native way to query the state of physical disks inside a RAID array using PowerShell.

Dell provides a wide array of WMI classes and properties you can query to get anything from the server temperature to the power supply voltage. But to read physical disk status you must still use omreport, which is a tool that outputs text to a string.

If you are familiar with PowerShell, you will know that manipulating text strings can be difficult, especially if you try to "guess" the output by statically formatting the output based on carriage returns or something similar. However, using a method I developed or picked up somewhere (not invented I'm sure), you can parse a single line of the text output by using a foreach statement.

The output of an omreport shows us they follow a very specific format, which allows us to pick out the start and end of any one disk. This means we can convert that text to an object, at which point PowerShell can work its magic.

So how do we do that?

The command to pull a report from the PERC using omreport is:

(where 0 is the controller number)

Depending on how many disks you have on the controller, you may be scrolling for some time to reach the top of the output, as each disk returns 43 properties. Depending on what you are querying the controller for, many of these are redundant.

Personally, I want a quick way to report on any issues with the disks. For that, I decided the best properties to collect would be ID, Status, State, ProductID, Serial, and Capacity. This should quickly allow me to identify in what position a failed disk is physically located, what capacity it is, and the product ID/serial number if I should need to look for a replacement.

If we save the entire report in a variable ($storage), we can process each line of text looking for the first and last property we want to collect, and let that signify the end of the object and the creation of a new object.

For example,

This would tell PowerShell to process the $storage report, and for every line that contained the label "ID," create a new $disk object, perform some manipulation of the text, and then add that information to the $disk object.

Displaying the disk ID

Displaying the disk ID

As we add additional properties to collect, we can start to see the $disk object becoming quite useful.

So from here I can see disk IDs with non-critical errors.

Displaying the disk status

Displaying the disk status

Then with a small tweak, we can add these individual $disk objects into an array and start to work with them.

Disks with errors

Disks with errors

How about adding a parameter to set which controllers you want to search?

If we then look at the completed script querying controller 0 and 1, we get the following:

Displaying only errors

Displaying only errors

I wanted to output a report of disks with errors to my SolarWinds Remote Monitoring & Management (RMM) platform, but unfortunately their script engine doesn't support passing variables through the command line. So I had to use one of the earlier mentioned WMI queries to collect info across all controllers automatically.

SolarWinds Remote Monitoring & Management platform

SolarWinds Remote Monitoring & Management platform

You can find more info on the Dell WMI queries and OpenManage here.

Join the 4sysops PowerShell group!

Your question was not answered? Ask in the forum!

3+
avataravatar
Share
2 Comments
  1. d-.-b 2 years ago

    Thanks for this, I have been using the GUI version of OpenManage Server Administrator for awhile now but I have neglected to work through the powershell queries, I have a feeling this will come in useful on Hyper-V core installs.

    1+
    avatar
  2. How come I did not notice this earlier 🙁

    0

Leave a reply

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

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account