Jump to content

Drive Temperature


James
 Share

Recommended Posts

I retested - was reading the 'SMART' tab of SpeedFan instead of the 'Readings' tab (why don't those temps equal each other I don't know)

Anyway, got hits at [151] for a Maxtor and Hitachi drive,

and hits at [139] for Western Digital drives

Edited by ascendant
Link to comment
Share on other sites

  • 5 months later...

@All

Confirmed 139 for a WD drive.

Dim $strComputer = "."
Dim $objWMIService, $oMyError
Dim $colTemp

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\WMI")

$colTemp = $objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_ATAPISmartData")
For $objItem In $colTemp
    $strVendorSpecific = $objItem.VendorSpecific
    ConsoleWrite("Current Temperature C : " & $strVendorSpecific[139] & @CRLF)
    ConsoleWrite("Current Temperature F : " & $strVendorSpecific[137] & @CRLF)
Next

Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    MsgBox(0, "COM Error Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: " & @TAB & $HexNumber & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
    SetError(1); to check for after this function returns
EndFunc  ;==>MyErrFunc

Regards,

ptrex

Link to comment
Share on other sites

  • 3 years later...

@JamesBrooks

I've done some tests and found some arrays matching with my Drive temperature :

$strVendorSpecific[127]
$strVendorSpecific[130]
$strVendorSpecific[137]
$strVendorSpecific[139]
 

 

The location varies. You can find it by using the following sniplet

#RequireAdmin

Dim $strComputer = "."
Dim $objWMIService, $oMyError
Dim $colTemp

If Not @Compiled Then
    ConsoleWrite("HDD Temperature(s): " & _WMI_GetATAPISmartData() & @CRLF)
EndIf

Func _WMI_GetATAPISmartData()
    #cs
        Data Structure 362 Bytes:
        Word Vendor
        Byte Vendordata[12] = ( byte ID; byte data[11])
        
        see: http://en.wikipedia.org/wiki/S.M.A.R.T.
        
        1   0x01    Read Error Rate
        2   0x02    Throughput Performance
        3   0x03    Spin-Up Time
        4   0x04    Start/Stop Count
        5   0x05    Reallocated Sectors Count
        6   0x06    Read Channel Margin
        7   0x07    Seek Error Rate
        8   0x08    Seek Time Performance
        9   0x09    Power-On Hours (POH)
        10  0x0A    Spin Retry Count
        11  0x0B    Recalibration Retries or Calibration Retry Count
        12  0x0C    Power Cycle Count
        13  0x0D    Soft Read Error Rate
        180 0xB4    Unused Reserved Block Count Total
        183 0xB7    SATA Downshift Error Count or Runtime Bad Block
        184 0xB8    End-to-End error / IOEDC
        185 0xB9    Head Stability
        186 0xBA    Induced Op-Vibration Detection
        187 0xBB    Reported Uncorrectable Errors
        188 0xBC    Command Timeout
        189 0xBD    High Fly Writes
        190 0xBE    Airflow Temperature (WDC) resp. Airflow Temperature Celsius (HP)
        190 0xBE    Temperature Difference from 100
        191 0xBF    G-sense Error Rate
        192 0xC0    Power-off Retract Count or Emergency Retract Cycle Count (Fujitsu)[21]
        193 0xC1    Load Cycle Count or Load/Unload Cycle Count (Fujitsu)
        194 0xC2    Temperature resp. Temperature Celsius <------------------------------------------------------------------------------------------
        195 0xC3    Hardware ECC Recovered
        196 0xC4    Reallocation Event Count
        197 0xC5    Current Pending Sector Count
        198 0xC6    Uncorrectable Sector Count or Offline Uncorrectable or Off-Line Scan Uncorrectable Sector Count[21]
        199 0xC7    UltraDMA CRC Error Count
        200 0xC8    Multi-Zone Error Rate [28]
        200 0xC8    Write Error Rate (Fujitsu)
        201 0xC9    Soft Read Error Rate or TA Counter Detected
        202 0xCA    Data Address Mark errors or TA Counter Increased
        203 0xCB    Run Out Cancel
        204 0xCC    Soft ECC Correction
        205 0xCD    Thermal Asperity Rate (TAR)
        206 0xCE    Flying Height
        207 0xCF    Spin High Current
        208 0xD0    Spin Buzz
        209 0xD1    Offline Seek Performance
        210 0xD2    Vibration During Write
        211 0xD3    Vibration During Write
        212 0xD4    Shock During Write
        220 0xDC    Disk Shift
        221 0xDD    G-Sense Error Rate
        222 0xDE    Loaded Hours
        223 0xDF    Load/Unload Retry Count
        224 0xE0    Load Friction
        225 0xE1    Load/Unload Cycle Count
        226 0xE2    Load 'In'-time
        227 0xE3    Torque Amplification Count
        228 0xE4    Power-Off Retract Cycle
        230 0xE6    GMR Head Amplitude
        230 0xE6    Drive Life Protection Status
        231 0xE7    Temperature
        231 0xE7    SSD Life Left
        232 0xE8    Endurance Remaining
        232 0xE8    Available Reserved Space
        233 0xE9    Power-On Hours
        233 0xE9    Media Wearout Indicator
        234 0xEA    Average erase count AND Maximum Erase Count
        235 0xEB    Good Block Count AND System(Free) Block Count
        240 0xF0    Head Flying Hours
        240 0xF0    Transfer Error Rate (Fujitsu)
        241 0xF1    Total LBAs Written
        242 0xF2    Total LBAs Read
        250 0xFA    Read Error Retry Rate
        254 0xFE    Free Fall Protection
    #ce

    Local $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\WMI")
    Local $s, $i, $strVendorSpecific, $colTemp

    $colTemp = $objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_ATAPISmartData")

    For $objItem In $colTemp
        $strVendorSpecific = $objItem.VendorSpecific
        For $i = 2 To UBound($strVendorSpecific) - 1 Step 12
            If $strVendorSpecific[$i] = 0xC2 Then ; find Vendor Parameter Line 194 - Temperatur
                $s &= " " & $strVendorSpecific[$i + 5] ; celsuis
                ExitLoop
            EndIf
        Next
    Next

    Return $s
EndFunc   ;==>_WMI_GetATAPISmartData

Func MyErrFunc()
    Local $HexNumber = Hex($oMyError.number, 8)
    MsgBox(0, "COM Error Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: " & @TAB & $HexNumber & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
    SetError(1); to check for after this function returns
EndFunc   ;==>MyErrFunc
Link to comment
Share on other sites

I know this is an old topic.

The difference in location can be expained.

You have to fine the corresponding dataset by ID.

Please see attached code.

#RequireAdmin
Dim $strComputer = "."
Dim $objWMIService, $oMyError
Dim $colTemp

If Not @Compiled Then
    ConsoleWrite("HDD Temperature(s): " & _WMI_GetATAPISmartData() & @CRLF)
EndIf

Func _MyErrFunc()
    Local $HexNumber = Hex($oMyError.number, 8)
    MsgBox(0, "COM Error Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: " & @TAB & $HexNumber & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
    SetError(1); to check for after this function returns
EndFunc   ;==>_MyErrFunc

Func _WMI_GetATAPISmartData()
    #cs
        Data Structure 362 Bytes:
        Word Vendor
        Byte Vendordata[12] = ( byte ID; byte data[11])
        data:
        01 - Attribute ID
        02 - Nom/Flag
        03 - Status
        04 - Value/%
        05 - Worst/%
        06 - Raw/Value
        07 - Cycles
        08 - VSD1
        09 - VSD2
        10 - VSD3
        11 - VSD4
        12 - VSD5
        
        see: http://en.wikipedia.org/wiki/S.M.A.R.T.

        Attriubuts:
        1   0x01    Read Error Rate
        2   0x02    Throughput Performance
        3   0x03    Spin-Up Time
        4   0x04    Start/Stop Count
        5   0x05    Reallocated Sectors Count
        6   0x06    Read Channel Margin
        7   0x07    Seek Error Rate
        8   0x08    Seek Time Performance
        9   0x09    Power-On Hours (POH)
        10  0x0A    Spin Retry Count
        11  0x0B    Recalibration Retries or Calibration Retry Count
        12  0x0C    Power Cycle Count
        13  0x0D    Soft Read Error Rate
        180 0xB4    Unused Reserved Block Count Total
        183 0xB7    SATA Downshift Error Count or Runtime Bad Block
        184 0xB8    End-to-End error / IOEDC
        185 0xB9    Head Stability
        186 0xBA    Induced Op-Vibration Detection
        187 0xBB    Reported Uncorrectable Errors
        188 0xBC    Command Timeout
        189 0xBD    High Fly Writes
        190 0xBE    Airflow Temperature (WDC) resp. Airflow Temperature Celsius (HP)
        190 0xBE    Temperature Difference from 100
        191 0xBF    G-sense Error Rate
        192 0xC0    Power-off Retract Count or Emergency Retract Cycle Count (Fujitsu)[21]
        193 0xC1    Load Cycle Count or Load/Unload Cycle Count (Fujitsu)
        194 0xC2    Temperature resp. Temperature Celsius
        195 0xC3    Hardware ECC Recovered
        196 0xC4    Reallocation Event Count
        197 0xC5    Current Pending Sector Count
        198 0xC6    Uncorrectable Sector Count or Offline Uncorrectable or Off-Line Scan Uncorrectable Sector Count[21]
        199 0xC7    UltraDMA CRC Error Count
        200 0xC8    Multi-Zone Error Rate [28]
        200 0xC8    Write Error Rate (Fujitsu)
        201 0xC9    Soft Read Error Rate or TA Counter Detected
        202 0xCA    Data Address Mark errors or TA Counter Increased
        203 0xCB    Run Out Cancel
        204 0xCC    Soft ECC Correction
        205 0xCD    Thermal Asperity Rate (TAR)
        206 0xCE    Flying Height
        207 0xCF    Spin High Current
        208 0xD0    Spin Buzz
        209 0xD1    Offline Seek Performance
        210 0xD2    Vibration During Write
        211 0xD3    Vibration During Write
        212 0xD4    Shock During Write
        220 0xDC    Disk Shift
        221 0xDD    G-Sense Error Rate
        222 0xDE    Loaded Hours
        223 0xDF    Load/Unload Retry Count
        224 0xE0    Load Friction
        225 0xE1    Load/Unload Cycle Count
        226 0xE2    Load 'In'-time
        227 0xE3    Torque Amplification Count
        228 0xE4    Power-Off Retract Cycle
        230 0xE6    GMR Head Amplitude
        230 0xE6    Drive Life Protection Status
        231 0xE7    Temperature
        231 0xE7    SSD Life Left
        232 0xE8    Endurance Remaining
        232 0xE8    Available Reserved Space
        233 0xE9    Power-On Hours
        233 0xE9    Media Wearout Indicator
        234 0xEA    Average erase count AND Maximum Erase Count
        235 0xEB    Good Block Count AND System(Free) Block Count
        240 0xF0    Head Flying Hours
        240 0xF0    Transfer Error Rate (Fujitsu)
        241 0xF1    Total LBAs Written
        242 0xF2    Total LBAs Read
        250 0xFA    Read Error Retry Rate
        254 0xFE    Free Fall Protection
    #ce

    Local $oMyError = ObjEvent("AutoIt.Error", "_MyErrFunc")
    Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\WMI")
    Local $s, $i, $strVendorSpecific, $colTemp

    $colTemp = $objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_ATAPISmartData")

    For $objItem In $colTemp
        $strVendorSpecific = $objItem.VendorSpecific
        For $i = 2 To UBound($strVendorSpecific) - 1 Step 12
            If $strVendorSpecific[$i] = 0xC2 Then ; find Vendor Parameter #194 - Temperatur
                $s &= " " & $strVendorSpecific[$i + 5] ; Raw/Value celsuis
                ContinueLoop 2
            EndIf
        Next
        For $i = 2 To UBound($strVendorSpecific) - 1 Step 12
            If $strVendorSpecific[$i] = 0xBE Then ; find Vendor Parameter #190 - Airflow Temperatur (if no tempetature is found)
                $s &= " " & $strVendorSpecific[$i + 5] ; Raw/Value celsuis
                ContinueLoop 2
            EndIf
        Next
    Next
    Return $s

EndFunc   ;==>_WMI_GetATAPISmartData
Link to comment
Share on other sites

  • 3 years later...

Hey guys,

I know this is a very old topic but i really need your help.

Im trying to find the Power-on Hours of Hard Disk like when I use the CristalDiskInfo.

I need the result in Hours or Hexadecimal as you can see in the image attached but when i use the script above changing the Temperature value to Power-On Hours, that bring me a different result.

Thanks and sry for my bad english

Crystal.jpg

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 years later...
On 7/2/2013 at 5:46 AM, panyndrom said:

Excellent code, ask how to get the temperature of each disc separately Thanks in advance

#RequireAdmin

Dim $strComputer = "."
Dim $objWMIService, $oMyError
Dim $colTemp

If Not @Compiled Then
    ConsoleWrite("HDD Temperature(s): " & _WMI_GetATAPISmartData() & @CRLF)
EndIf

Func _WMI_GetATAPISmartData()
    #cs
        Data Structure 362 Bytes:
        Word Vendor
        Byte Vendordata[12] = ( byte ID; byte data[11])
        
        see: http://en.wikipedia.org/wiki/S.M.A.R.T.
        
        1   0x01    Read Error Rate
        2   0x02    Throughput Performance
        3   0x03    Spin-Up Time
        4   0x04    Start/Stop Count
        5   0x05    Reallocated Sectors Count
        6   0x06    Read Channel Margin
        7   0x07    Seek Error Rate
        8   0x08    Seek Time Performance
        9   0x09    Power-On Hours (POH)
        10  0x0A    Spin Retry Count
        11  0x0B    Recalibration Retries or Calibration Retry Count
        12  0x0C    Power Cycle Count
        13  0x0D    Soft Read Error Rate
        180 0xB4    Unused Reserved Block Count Total
        183 0xB7    SATA Downshift Error Count or Runtime Bad Block
        184 0xB8    End-to-End error / IOEDC
        185 0xB9    Head Stability
        186 0xBA    Induced Op-Vibration Detection
        187 0xBB    Reported Uncorrectable Errors
        188 0xBC    Command Timeout
        189 0xBD    High Fly Writes
        190 0xBE    Airflow Temperature (WDC) resp. Airflow Temperature Celsius (HP)
        190 0xBE    Temperature Difference from 100
        191 0xBF    G-sense Error Rate
        192 0xC0    Power-off Retract Count or Emergency Retract Cycle Count (Fujitsu)[21]
        193 0xC1    Load Cycle Count or Load/Unload Cycle Count (Fujitsu)
        194 0xC2    Temperature resp. Temperature Celsius <------------------------------------------------------------------------------------------
        195 0xC3    Hardware ECC Recovered
        196 0xC4    Reallocation Event Count
        197 0xC5    Current Pending Sector Count
        198 0xC6    Uncorrectable Sector Count or Offline Uncorrectable or Off-Line Scan Uncorrectable Sector Count[21]
        199 0xC7    UltraDMA CRC Error Count
        200 0xC8    Multi-Zone Error Rate [28]
        200 0xC8    Write Error Rate (Fujitsu)
        201 0xC9    Soft Read Error Rate or TA Counter Detected
        202 0xCA    Data Address Mark errors or TA Counter Increased
        203 0xCB    Run Out Cancel
        204 0xCC    Soft ECC Correction
        205 0xCD    Thermal Asperity Rate (TAR)
        206 0xCE    Flying Height
        207 0xCF    Spin High Current
        208 0xD0    Spin Buzz
        209 0xD1    Offline Seek Performance
        210 0xD2    Vibration During Write
        211 0xD3    Vibration During Write
        212 0xD4    Shock During Write
        220 0xDC    Disk Shift
        221 0xDD    G-Sense Error Rate
        222 0xDE    Loaded Hours
        223 0xDF    Load/Unload Retry Count
        224 0xE0    Load Friction
        225 0xE1    Load/Unload Cycle Count
        226 0xE2    Load 'In'-time
        227 0xE3    Torque Amplification Count
        228 0xE4    Power-Off Retract Cycle
        230 0xE6    GMR Head Amplitude
        230 0xE6    Drive Life Protection Status
        231 0xE7    Temperature
        231 0xE7    SSD Life Left
        232 0xE8    Endurance Remaining
        232 0xE8    Available Reserved Space
        233 0xE9    Power-On Hours
        233 0xE9    Media Wearout Indicator
        234 0xEA    Average erase count AND Maximum Erase Count
        235 0xEB    Good Block Count AND System(Free) Block Count
        240 0xF0    Head Flying Hours
        240 0xF0    Transfer Error Rate (Fujitsu)
        241 0xF1    Total LBAs Written
        242 0xF2    Total LBAs Read
        250 0xFA    Read Error Retry Rate
        254 0xFE    Free Fall Protection
    #ce

    Local $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\WMI")
    Local $s, $i, $strVendorSpecific, $colTemp

    $colTemp = $objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_ATAPISmartData")

    For $objItem In $colTemp
        $strVendorSpecific = $objItem.VendorSpecific
        For $i = 2 To UBound($strVendorSpecific) - 1 Step 12
            If $strVendorSpecific[$i] = 0xC2 Then ; find Vendor Parameter Line 194 - Temperatur
                $s &= " " & $strVendorSpecific[$i + 5] ; celsuis
                ExitLoop
            EndIf
        Next
    Next

    Return $s
EndFunc   ;==>_WMI_GetATAPISmartData

Func MyErrFunc()
    Local $HexNumber = Hex($oMyError.number, 8)
    MsgBox(0, "COM Error Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: " & @TAB & $HexNumber & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
    SetError(1); to check for after this function returns
EndFunc   ;==>MyErrFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...