ptrex Posted June 16, 2006 Share Posted June 16, 2006 (edited) SMART drive Analysis For all of those who don't know what SMART is, let me explain : What is S.M.A.R.T. technology for hard drives? S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) is implemented into all of the modern hard disks. A special program inside the disk constantly keeps tracking the condition of a range of the vital parameters: driver, disk heads, surface state, electronics, etc. At the present time, S.M.A.R.T. technology is able to predict up to 70% of all hard disk problems! However, to use this information, you firstly have to retrieve it from the disk and analyze it. This is one of the Active SMART program's tasks For this script I have used the freeware tool SMART.EXE from BeyondLogic. It has a very small footprint and therefor a good combination with AutoIT. Download it here SMART Tool Furthermore I combined it with SQLite DB, to log all the analysis information. In order to be able to see the trend of the drive's health over time. Here is the script. SMART.au3 For educational reasons I have used an in "Memory DB", meaning the data want be saved. The output will be save to the SciTE console. I hope that this helps you all to prevent loosing the valuable scripts as a cause of a crash. Added a new version which in not depending on an external EXE file, and is able to retrieve remote data from a Harddisk. SMART_WMI.au3 Enjoy Edited September 14, 2012 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ptrex Posted June 21, 2006 Author Share Posted June 21, 2006 (edited) For those who are not fond of SQLite I have created a version that logs the details into the EVentViewer : expandcollapse popup#include <Date.au3> Dim $Path = "C:\_\Apps\AutoIT3\_Development\SMART\smart.exe" Dim $sRecord, $sDataOut Dim $Column1,$Column2,$Column3,$Column4,$Column5,$Column6,$Column7,$Column8 ;Dim $hQuery, $iRval, $aResult, $iRows, $aRow, $iColumns _Smart() _PopulateColumns() Func _Smart() $Smart = Run($Path, "", @SW_HIDE, 2) Local $sDataOut = "" Sleep(500) While 1 $sDataOut &= StdOutRead($Smart) If @error = -1 Then ExitLoop $sRecord = stringsplit($sDataOut,@CRLF) WEnd Return $sRecord EndFunc Func _PopulateColumns() For $i = 27 to 59 Step 2 $Column0 = _Now() $Column1 = Stringleft($sRecord[$i],4) $Column2 = stringmid($sRecord[$i],6,26) $Column3 = stringmid($sRecord[$i],33,10) $Column4 = stringmid($sRecord[$i],45,3) $Column5 = stringmid($sRecord[$i],51,3) $Column6 = stringmid($sRecord[$i],57,3) $Column7 = stringmid($sRecord[$i],62,9) $Column8 = stringmid($sRecord[$i],72,2) If $Column8 = "OK" Then Run("eventcreate /T Information /ID 100 /L Application /SO SMART /D " & _ Chr(34) & "SMART Harddisk Status : "&$Column8 & _ @CR&"ID"&" "&"Attribute"&@Tab&@Tab&"Type"&@Tab&"Threshold"&@Tab&" Value"&" "&"Worst"&" "&"Raw"& _ @CR&$Column1&" "&$Column2&" "&$Column3&" "&$Column4&@Tab&$Column5&" "&$Column6&" "&$Column7&Chr(34), "", @SW_HIDE, 2) Else Run("eventcreate /T Error /ID 999 /L Application /D " & _ Chr(34) & "SMART Harddisk Status : "&$Column8 & _ @CR&"ID"&" "&"Attribute"&@Tab&@Tab&"Type"&@Tab&"Threshold"&@Tab&" Value"&" "&"Worst"&" "&"Raw"& _ @CR&$Column1&" "&$Column2&" "&$Column3&" "&$Column4&@Tab&$Column5&" "&$Column6&" "&$Column7&Chr(34), "", @SW_HIDE, 2) Endif Next EndFunc You can schedule the script in a Job and run it every day. If some parameters will by higher than the Threshold value, a RED ALERT will be logged in the Event Viewer. Otherwise an normal event will be logged. Enjoy !! Edited June 21, 2006 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Dizzy Posted September 18, 2006 Share Posted September 18, 2006 Hi ptrex, i get following error in scite : \Autoit\Smart Analysis\smart.au3 (63) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $Column1 = Stringleft($sRecord[$i],4) $Column1 = Stringleft(^ ERROR I'm using version 3.2.0.1 Any ideas? Greets Dizzy Link to comment Share on other sites More sharing options...
ptrex Posted September 18, 2006 Author Share Posted September 18, 2006 @Dizzy Hello, sorry for the Errors, but this version is outdated. I have added a new version which is not depending on an external EXE or DLL file. You can also run this to retrieve remote Hard Disk Data from a PC or Server. See first post. Enjoy !! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
james3mg Posted September 18, 2006 Share Posted September 18, 2006 (edited) When I run your newest version which is not dependant on an external .exe file, I receive the following error three times: We intercepted a COM Error! err.description is: err.windescription is: err.number is: 80041003 err.lastdllerror is: 0 err.scriptline is: 30 (second time this number is 37, third time this number is 42) err.source is: err.helpfile is: err.helpcontext is: Then I get an AutoIt Error: Line 67 (File ...): Dim $Temp[17] = [$strVendorSpecific[5] > $strVendorSpecific2[3],$strVendorSpecific[17] > $strVendorSpecific2[15]] Dim $Temp[17] = [$strVendorSpecific^ ERROR Error: Subscript used with non-Array variable. After which the script ends. Not being too familiar with COM functions or use myself, I'm not sure if this is reporting a SMART error on my drive, or a problem with the script on the OS I'm using on this machine (Windows Vista RC1) Can you tell me how to interpert these messages, pretty please? Thanks Edit: Fixed those stupid double-linebreaks I always seem to get... Edited September 18, 2006 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
logi Posted September 18, 2006 Share Posted September 18, 2006 Works perfectly, great app! Link to comment Share on other sites More sharing options...
ptrex Posted September 18, 2006 Author Share Posted September 18, 2006 @james3mg I am sure it has something to with "Windows Vista RC1" release. Because I ran this on XP and 2000 with not problems !! As you can see some of them are have no errors reported. Nevertheless the code is not finished yet, but it should run without errors. Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
logi Posted September 18, 2006 Share Posted September 18, 2006 @james3mgI am sure it has something to with "Windows Vista RC1" release. Because I ran this on XP and 2000 with not problems !!As you can see some of them are have no errors reported.Nevertheless the code is not finished yet, but it should run without errors.Regardsptrexhe fixed it already: Edit: Fixed those stupid double-linebreaks I always seem to get... Link to comment Share on other sites More sharing options...
james3mg Posted September 20, 2006 Share Posted September 20, 2006 he fixed it already: No, unfortunately not...My Edit was just fixing the extra lines I always end up getting in my forum posts, and I marked what I edited as a courtesy, since it's noted that I edited my post below the post itself. I'll try again in future Vista releases and keep you posted, or come January, lots of people might be complaining :-) "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted July 4, 2007 Share Posted July 4, 2007 @ptrex I've got the same error as james3mg Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
james3mg Posted July 5, 2007 Share Posted July 5, 2007 @ptrexI've got the same error as james3mgNote that, though I haven't reported back until now, once I installed Vista Business (retail), I'm not getting those errors anymore, though I'm thinking I'll probably change the output function to format the data into a TreeView control ... the MsgBox leaves the data looking nasty and unreadable, at least on my machine. "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
martin Posted July 5, 2007 Share Posted July 5, 2007 (edited) The columns are not aligned correctly when I try this. (XP SP1) Great utility though Edited July 5, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted July 7, 2007 Share Posted July 7, 2007 and the strangest thing is .... the problem .. does not exist anymore.. on my computer... and i use XPPro instead of Vista Emiel Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
ptrex Posted July 7, 2007 Author Share Posted July 7, 2007 @all Good to see it"s still running. The layout problem can easily be fixed by yourselve. It is depending on the output of your HD. Rgds ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Hellsum Posted September 21, 2007 Share Posted September 21, 2007 Hi, I found your script usefull, and I used it in various way in my scripts, It worked perfectly on my desktop PC. When Ive tryd to use it on my Notebook, or my friend Desktop, I get allways the same error: C:\HDscript\HD1.au3 (67) : ==> Subscript used with non-Array variable.: Dim $Temp[17] = [$strVendorSpecific[5] > $strVendorSpecific2[3],$strVendorSpecific[17] > $strVendorSpecific2[15]] Dim $Temp[17] = [$strVendorSpecific^ ERROR None of those computers have Vista, working desktop, notebook and notworking desktop have XP sp2. How can I fix that? thx in advance Link to comment Share on other sites More sharing options...
ptrex Posted September 21, 2007 Author Share Posted September 21, 2007 @Hellsum The main reason might be the the HD is not compliant with the S.M.A.R.T protocol. And does not expose the SMART data to the OS. In my first post there is a link to a commandline tool. Thry to run this to check of there is data returned. regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ChrisL Posted December 3, 2007 Share Posted December 3, 2007 Ptrex I have modified your excellent WMI script a little I hope you don't mind. I've made it use a 2d array rather than a message box and simplified some of the creation of the data also adding in the column where the data type is to indicated if it is a predictive failure value or advisory and also the ability to specify the drive you wish to analyze if required. ChrisSMART_WMI.au3 mLipok 1 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ptrex Posted December 3, 2007 Author Share Posted December 3, 2007 @ChrisL Don't mind at all !! it is looking realy good now !! regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted January 2, 2008 Share Posted January 2, 2008 Hi All, I am wondering why the smart_wmi.au3 checks the floppy drive. Can this be disabled ? Happy New Year Emiel Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
ptrex Posted January 2, 2008 Author Share Posted January 2, 2008 @Emiel Wieldraaijer Maybe you can use the version of ChrisL where the drive can be specified. regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now