PowerShell for Windows Admins

Jan 20 2012   2:58PM GMT

SMART disks

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:

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!

1  Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.
  • RussR123

    Win32_DiskDrive status VS MSStorageDriver_FailurePredictStatus


    any idea why i would get 2 different results when i run this?

    1 says fail, the other says all OK?

    EXAMPLE: PC1 has 2 drives, when i run this..

    $computers = Get-Content “C:\Temp\BadHDlist.txt” foreach ($computer in $computers){ $WMI = Get-WMIObject -Computer $computer -namespace root\wmi -Class MSStorageDriver_FailurePredictStatus -ErrorAction Silentlycontinue ForEach ($Drive in $WMI){$computer + ” : ” + $Drive.PredictFailure + ” : ” + $Drive.Reason + ” : ” + $Drive.InstanceName}}

    i get this..

    PC1: False : 0 : IDE\DiskST380011A____________________________8.16_\4a3343564732524320 2020202020202020202020_0

    PC1: True : 0 : IDE\DiskMaxtor6E040L0_________________________NAR61590\3145384b38514542202

    when i run this…

    $WMI = Get-WMIObject -Computer PC1 -Class Win32_DiskDrive ForEach ($Drive in $WMI){$Drive.Caption + “: ” + $Drive.Status}

    i get this…

    Maxtor 6E040L0: OK ST380011A: OK

    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: