Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to see the Hard Disk temperature with some kind of S.M.A.R.T API or anything like that?if yes than how ?

i want to use it in one desktop application.
Posted
Updated 27-Aug-13 0:17am
v3

How-to-retrieve-hard-drive-temperature[^]

Check the link..hope it will help you...
 
Share this answer
 
 
Share this answer
 
//S.M.A.R.T.  Temperature attritube
const byte TEMPERATURE_ATTRIBUTE = 194;
public List GetDriveTemp()
{
    List retval = new List();
    try
    {
        ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData");
                //loop through all the hard disks
        foreach (ManagementObject queryObj in searcher.Get())
        {
            byte[] arrVendorSpecific = (byte[])queryObj.GetPropertyValue("VendorSpecific");
            //Find the temperature attribute
                        int tempIndex = Array.IndexOf(arrVendorSpecific, TEMPERATURE_ATTRIBUTE);
            retval.Add(arrVendorSpecific[tempIndex + 5]);
        }
    }
    catch (ManagementException err)
    {
        Console.WriteLine("An error occurred while querying for WMI data: " + err.Message);
    }
    return retval;
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900