I am writing an application based on .NET that checks the heath of a disk or more disks in a system.
I can use the WMI interface for ATAPI to get at the SMART data, followed by link: http://wutils.com/wmi/root/wmi/msstoragedriver_atapismartdata/
But i don't know how to execute SMART Self-Test. Is there any ways to do it by using C#?
I was trying to do the same and found out that it is possible to start the test via WMI. Have a look at the WMI class
MSStorageDriver_FailurePredictFunctionunder theROOT\WMInamespace. The class has several different methods you can use. One of them is theExecuteSelfTestmethod. Look at this example I created with the WMI Code Creator(WMICodeCreator)You have to change the InstanceName in the code above to your diskname. What I also found out is that the
"Subcommand"parameter is the factor which determines what test you actually start. If the value is1you start theShort Self-test. If the value is2you start theExtended Self-test.As an output Parameter you can receive one of those three values
['0', '1', '2']while0stands for'Successful Completion',1stands for'Captive Mode Required'and2stands for'Unsuccessful Completion'. Source(FailurePredictFunction)