Windows: Get Disk Smartparameter and Health status

Hi,

in newer Versions of the Windows operating system you to not need additional tools to get the most important Harddisk smart parameters.

An overall state of the disks gets the following query. For all supported drives an Property PredictFailure is added.

$aDisks=Get-WmiObject -namespace root\cimv2 -class Win32_DiskDrive
$aDisks | % {
   $oFailurePredictStatusDisk=Get-WmiObject -Namespace "root\wmi" -query ("select * from MSStorageDriver_FailurePredictStatus where InstanceName like'"+$_.PNPDeviceID.Replace("\","\\")+"%'")
   if($oFailurePredictStatusDisk)
   {
       Add-Member -memberType NoteProperty -InputObject ($_) -Name PredictFailure -Value $oFailurePredictStatusDisk.PredictFailure
   }
}
PS C:\> $aDisks|ft -AutoSize Model,DeviceID,PredictFailure

Model                     DeviceID           PredictFailure
-----                     --------           --------------
Samsung SSD 860 EVO 250GB \\.\PHYSICALDRIVE1          False
SanDisk Ultra USB Device  \\.\PHYSICALDRIVE2
SATA SSD                  \\.\PHYSICALDRIVE0          False

And with some more details

$aAddProperty=@("ReadErrorsCorrected","ReadErrorsTotal","Temperature","PowerOnHours","ReadLatencyMax","WriteLatencyMax","Wear")
$aDisks=Get-WmiObject -namespace root\cimv2 -class Win32_DiskDrive
$aDisks | % {
   $oFailurePredictStatusDisk=Get-WmiObject -Namespace "root\wmi" -query ("select * from MSStorageDriver_FailurePredictStatus where InstanceName like'"+$_.PNPDeviceID.Replace("\"  ,"\\")+"%'")
   if($oFailurePredictStatusDisk)
   {
       Add-Member -memberType NoteProperty -InputObject ($_) -Name PredictFailure -Value $oFailurePredictStatusDisk.PredictFailure
   }
   $oStorageReliability=Get-PhysicalDisk -DeviceNumber $_.Index|Get-StorageReliabilityCounter
   foreach($sProperty in $aAddProperty)
   {
       Add-Member -memberType NoteProperty -InputObject ($_) -Name $sProperty -Value $oStorageReliability.$sProperty
   }
}
PS C:\> $aDisks|ft -AutoSize Model,DeviceID,PredictFailure,ReadErrorsTotal,ReadErrorsCorrected,PowerOnHours

Model                     DeviceID           PredictFailure ReadErrorsTotal ReadErrorsCorrected PowerOnHours
-----                     --------           -------------- --------------- ------------------- ------------
Samsung SSD 860 EVO 250GB \\.\PHYSICALDRIVE1          False               0                   0          303
SanDisk Ultra USB Device  \\.\PHYSICALDRIVE2
SATA SSD                  \\.\PHYSICALDRIVE0          False                                              409

One thought on “Windows: Get Disk Smartparameter and Health status”

  1. There s really not a lot more to the app, but there is one other feature worth pointing out. If you are particularly concerned about the health of a drive, you can set CrystalDiskInfo to start with Windows and run as a background app. While it s running this way, CrystalDiskInfo will send a notification to alert you if the S.M.A.R.T. status of any drive changes. Just open the Function menu and toggle both the Resident and Startup options on.

Leave a Reply Cancel reply