c# - How to execute SMART Self-Test -


i writing application based on .net checks heath of disk or more disks in system.

i can use wmi interface atapi @ smart data, followed link: http://wutils.com/wmi/root/wmi/msstoragedriver_atapismartdata/

but don't know how execute smart self-test. there ways using c#?

i trying same , found out possible start test via wmi. have @ wmi class msstoragedriver_failurepredictfunction under root\wmi namespace. class has several different methods can use. 1 of them executeselftest method. @ example created wmi code creator(wmicodecreator)

            try             {                 managementobject classinstance =                      new managementobject("root\\wmi",                      "msstoragedriver_failurepredictfunction.instancename='scsi\disk&ven_hitachi&prod_hds721010cla632\4&7d4adf0&0&010000_0'",                     null);                  // obtain in-parameters method                 managementbaseobject inparams =                      classinstance.getmethodparameters("executeselftest");                  // add input parameters.                 inparams["subcommand"] =  1;                  // execute method , obtain return values.                 managementbaseobject outparams =                      classinstance.invokemethod("executeselftest", inparams, null);                  // list outparams                 console.writeline("out parameters:");                 console.writeline("returncode: " + outparams["returncode"]);             }             catch(managementexception err)             {                 messagebox.show("an error occurred while trying execute wmi method: " + err.message);             } 

you have change instancename in code above diskname. found out "subcommand" parameter factor determines test start. if value 1 start short self-test. if value 2 start extended self-test.

as output parameter can receive 1 of 3 values ['0', '1', '2'] while 0 stands 'successful completion' , 1 stands 'captive mode required' , 2 stands 'unsuccessful completion'. source(failurepredictfunction)


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -