;2016-11-29 #include 'array.au3' #RequireAdmin Opt('MustDeclareVars', 1) ; Local $rtn = MiniSMART() If $rtn < 0 Then MsgBox(0, 'MiniSMART', $rtn) Exit ; Func MiniSMART() Local $pid = Run('WMIC /NAMESPACE:\\root\wmi PATH MSStorageDriver_ATAPISmartData GET VendorSpecific /format:LIST', '', @SW_HIDE, 6) If @error Or Not $pid Then Return -1 Local $s = '' ; Do Sleep(10) $s &= StdoutRead($pid) Until @error ; $s = StringStripWS($s, 8) If StringLen($s) < 700 Then Return -2; insufficient data $s = StringTrimLeft($s, 21) Local $a = StringSplit($s, ',') $s = '' ; $pid = Run('WMIC DiskDrive Where DeviceID="\\\\.\\PHYSICALDRIVE0" GET Model /format:LIST', '', @SW_HIDE, 6) Do Sleep(10) $s &= StdoutRead($pid) Until @error ; Local $sModel = StringStripWS($s, 7) ; Local $aSMART[51][6] = [[50, 'Raw/Value', 'Cycles', 'VSD1', 'SumCounts', 'AttributeName']] Local $aAttributes = GetAttributes() Local $n = 0 ; For $i = 1 To $a[0] Step 12 If $a[$i] = 0 Then; clean up array when done ReDim $aSMART[$n + 1][6] $aSMART[0][0] = $n ExitLoop EndIf ; $n += 1 ; convert raw text to number format $aSMART[$n][0] = Number($a[$i]); Attribute Number $aSMART[$n][1] = Number($a[$i + 5]); Raw/Value $aSMART[$n][2] = Number($a[$i + 6]); Cycles $aSMART[$n][3] = Number($a[$i + 7]); VSD1 ; ; insert Attribute Names for the drive For $j = 1 To $aAttributes[0][0] If $aAttributes[$j][0] = $aSMART[$n][0] Then $aSMART[$n][5] = $aAttributes[$j][1] EndIf Next ; If StringLen($aSMART[$n][5]) = 0 Then $aSMART[$n][5] = '(VendorSpecific)' EndIf ; ; calculations Switch $aSMART[$n][0] Case 3; <-- SpinUpTime (most values are in milliseconds) $aSMART[$n][4] = $aSMART[$n][1] + ($aSMART[$n][2] * 256) Case 9; <-- PowerOnHours $aSMART[$n][4] = $aSMART[$n][1] + _; value for this cycle ($aSMART[$n][2] * 256) + _; cycles multiplier (256) ($aSMART[$n][3] * 65536); extended cycles multiplier (256x256) Case 190, 194; <-- Temperature $aSMART[$n][4] = $aSMART[$n][1] & 'C/' & Round($aSMART[$n][1] * 1.8) + 32 & 'F' Case Else If StringInStr($aSMART[$n][5], 'Count') Then $aSMART[$n][4] = $aSMART[$n][1] + ($aSMART[$n][2] * 256) Else $aSMART[$n][4] = 0 EndIf EndSwitch Next $aSMART[0][0] = 'Attribute' _ArrayDisplay($aSMART, 'MiniSMART - ' & $sModel) Return 0 EndFunc ; Func GetAttributes() Local $a[82][2] = [[81, 'Attribute Name'], _ [1, 'ReadErrorRate'], _ [2, 'ThroughputPerformance'], _ [3, 'SpinUpTime'], _ [4, 'StartStopCount'], _ [5, 'ReallocatedSectorsCount/SSDRetiredBlockCount'], _ [6, 'ReadChannelMargin'], _ [7, 'SeekErrorRate'], _ [8, 'SeekTimePerformance'], _ [9, 'PowerOnHours(POH)'], _ [10, 'SpinRetryCount'], _ [11, 'CalibrationRetryCount'], _ [12, 'PowerCycleCount'], _ [13, 'SoftReadErrorRate'], _ [22, 'Current Helium Level'], _ [170, 'SSDReservedBlockCount'], _ [171, 'SSDProgramFailBlockCount'], _ [172, 'SSDEraseFailBlockCount'], _ [173, 'SSDWearLevelingCount'], _ [174, 'SSDUnexpectedPowerLossCount'], _ [175, 'SSDProgramFailCount(Chip)'], _ [176, 'SSDEraseFailCount(Chip)'], _ [177, 'SSDWearRangeDelta/SSDWearLevelingCount'], _ [178, 'SSDUsedReservedBlockCount(Chip)'], _ [179, 'SSDUsedReservedBlockCount'], _ [180, 'BlockCountTotal/SSDUnusedReservedBlockCount'], _ [181, 'SSDProgramFailCount'], _ [182, 'SSDEraseFailCount'], _ [183, 'SATADownshiftErrorCount/SSDRuntimeBadBlock'], _ [184, 'EndtoEnderror'], _ [185, 'HeadStability'], _ [186, 'InducedOpVibrationDetection'], _ [187, 'ReportedUncorrectableErrors/SSDUncorrectableErrorCount'], _ [188, 'CommandTimeout'], _ [189, 'HighFlyWrites'], _ [190, 'AirflowTemperatureWDC/TemperatureDifferenceFrom100'], _ [191, 'GSenseErrorRate'], _ [192, 'PoweroffRetractCount'], _ [193, 'LoadCycleCount'], _ [194, 'Temperature'], _ [195, 'HardwareECCRecovered/SSDECCOnTheFlyCount'], _ [196, 'ReallocationEventCount'], _ [197, 'CurrentPendingSectorCount'], _ [198, 'UncorrectableSectorCount/SSDOffLineUncorrectableErrorCount'], _ [199, 'UltraDMACRCErrorCount/SSDCRCErrorCount'], _ [200, 'MultiZoneErrorRate/WriteErrorRate'], _ [201, 'OffTrackSoftReadErrorRate/SSDUncorrectableSoftReadErrorRate'], _ [202, 'DataAddressMarkErrors'], _ [203, 'RunOutCancel'], _ [204, 'SSDSoftECCCorrection'], _ [205, 'ThermalAsperityRate(TAR)'], _ [206, 'FlyingHeight'], _ [207, 'SpinHighCurrent'], _ [208, 'SpinBuzz'], _ [209, 'OfflineSeekPerformance'], _ [210, 'VibrationDuringWrite'], _ [211, 'VibrationDuringWrite'], _ [212, 'ShockDuringWrite'], _ [220, 'DiskShift'], _ [221, 'GSenseErrorRateAlt'], _ [222, 'LoadedHours'], _ [223, 'LoadUnloadRetryCount'], _ [224, 'LoadFriction'], _ [225, 'LoadUnloadCycleCount'], _ [226, 'LoadInTime'], _ [227, 'TorqueAmplificationCount'], _ [228, 'PowerOffRetractCycle'], _ [230, 'GMRHeadAmplitude/SSDLifeCurveStatus'], _ [231, 'SSDLifeLeft/Temperature'], _ [232, 'AvailableReservedSpace/EnduranceRemaining'], _ [233, 'MediaWearoutIndicator/PowerOnHours'], _ [234, 'SSDReservedVS'], _ [240, 'HeadFlyingHours/TransferErrorRate'], _ [241, 'SSDLifeTimeWritesFromHost/TotalLBAsWritten'], _ [242, 'SSDLifeTimeReadsFromHost/TotalLBAsRead'], _ [243, 'Total LBAs Written Expanded'], _ [244, 'Total LBAs Read Expanded'], _ [249, 'NAND_Writes_1GiB'], _ [250, 'ReadErrorRetryRate'], _ [251, 'Minimum Spares Remaining'], _ [252, 'Newly Added Bad Flash Block'], _ [254, 'FreeFallProtection']] Return $a EndFunc