Thursday, July 22, 2010

Disk drive health check with wmi and s.m.a.r.t in windows

Hard Disk DriveImage via Wikipedia

Fire up powershell

Overall hdd health
$hdhealth = Get-WmiObject -namespace root\wmi -class MSStorageDriver_FailurePredictStatus 

$hdhealth.PredictFailure <-- boolean, with False meaning O.K, and True indicatindg upcoming hdd fail.

Hdd temp
$hdtmp=Get-WmiObject -namespace root\wmi -class MSStorageDriver_ATAPISmartData

$hdtmp.VendorSpecific <-- array that contains (among many other things) your current hdd temp sensor reading in °C. Good luck with finding which one. It's called vendor specific for a reason :\.

You need to run the above commands in elevated privilege mode (true administrator) on new versions of windows, if you wish to get any useful output.

hint: Command substitution in powershell is the same as the same as new way in bash: 
bashvar=$(ls)
$powershellvar = $(Get-ChildItem)







Enhanced by Zemanta