In my experience – the most common failure for my servers is a failed hard disk. Now, as I have multiple levels of redundancy configured in my storage configuration, it is not always obvious that a disk has failed. Luckily, it is very easy to get this information with PowerShell.
In fact, this is one of the primary reasons why I like using storage spaces. The great integration with PowerShell. Here is the code that I use to generate this table:
Notes about this code:
- I am using “Get-PhysicalDisk”, “Get-StoragePool” and “Get-VirtualDisk” to gather the raw data.
- Once again – I use raw HTML to set the color of the table headers.
- Again – I run the output of these commands through Select-Object with the use of the “Expression” option to set column labels appropriately.
- Again – I use ConvertTo-HTML –Fragment to get a nice HTML table outputted.
- Again – I implement color coding for individual entries in the table. I set each table cell to be “red” by default. I then do some string parsing to see if the health is good – and switch the background color if I get a positive result.