SMART disks
A question on the forum about using WMI to work with SMART disks got my digging into the subject. SMART disks - http://en.wikipedia.org/wiki/S.M.A.R.T – detect and report on disk problems (hopefully) before they cause a catastrophe. While vendors’ implementations vary there are some things we can access.
The WMI classes are in the root\wmi namespace
PS> Get-WmiObject -Namespace root\wmi -List MSStorageDriver_Failure* | select Name
Name
----
MSStorageDriver_FailurePredictEvent
MSStorageDriver_FailurePredictFunction
MSStorageDriver_FailurePredictData
MSStorageDriver_FailurePredictThresholds
MSStorageDriver_FailurePredictStatus
The most immediate concern is – what is the status of our disks
function test-diskstatus {
[CmdletBinding()]
param (
[string]$computername = $env:COMPUTERNAME
)
Get-WmiObject -Namespace root\wmi -Class MSStorageDriver_FailurePredictStatus -ComputerName $computername |
select InstanceName, Active, PredictFailure, Reason
}
The InstanceName is long so the best display is list
PS> test-diskstatus | fl
InstanceName : IDE\DiskST9250320AS_____________________________HP07____\5&b0fd174&0&1.0.0_0
Active : True
PredictFailure : False
Reason : 0
The PredictFailure is the the important property & we worry when it is true!