Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_WMI_GetATAPISmartData v1.01

s.m.a.r.t.

  • Please log in to reply
71 replies to this topic

#1 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 08 May 2012 - 08:29 AM

Description <grin>

After diving into S.M.A.R.T from a previous thread... hmm, might as well take a stab at it.

One thing I did find after testing - The Drive Temperature is fairly accurate!

Then all I had to find out was how to calculate POH.

And, it dawned on me that it turns over every 1000... or is it 200, hmm. (It's 256)
Anyway it starts back at 1 and adds the total to another column.

So, I figured out (if my math was correct) that my hard drive's life is about half over. (sob)

There are about 20 known programs out there in cyberspace. I tested about half of them.

Almost none of those would show what I really wanted to know.
1. How many hours was on the HD.
2. What is the HD life expectancy.

Well, I found out both those answers after I made this script.

Let me know if any problems. I'll see what I can do about it.

Download Version 1.01
Attached File  _WMI_GetATAPISmartData_v1.01.au3   18.4KB   307 downloads

Updated: November 26, 2012
1) changed some logic.
2) added more error handling.
3) added two additional ways to detect SSD's.

Edited by ripdad, 26 November 2012 - 07:40 AM.

  • Emiel Wieldraaijer and UEZ like this
I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!







#2 ricky03

ricky03

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 279 posts

Posted 08 May 2012 - 10:51 AM

Hello,

thanks a lot, will you integrate it on your sysinfolog script?

Regards

#3 UEZ

UEZ

    Never say never

  • MVPs
  • 4,814 posts

Posted 08 May 2012 - 11:35 AM

Cool, nice to have function!

Thanks for sharing it!

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#4 Chimaera

Chimaera

    Sorry .. Where am i again?

  • Active Members
  • PipPipPipPipPipPip
  • 1,909 posts

Posted 08 May 2012 - 01:38 PM

Thx for sharing m8
One issue
It doesn't read SSD drives very well i have a relatively new couple of month old ish Vertex 2 drive
Posted Image

As you can see it gives a lot of exceeded lifetime so im guseeing because the drive has no hardware it doesnt read it right

Unless my drive is fooked....

If Ive just helped you ... miracles do happen. Chimaera 

 

CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()


#5 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 08 May 2012 - 07:55 PM

Thanks all

ricky03 - I need to spend some more time doing research on various vendor drives. But, if I do add it in SysInfoLog, it will just be raw data. I could make it write a table, I suppose. We'll see.

Chimaera - I'm surprised that SSD's are supported! It appears the columns are in order, but missing some attribute names. Some are New Attributes, although there are blocks that are reserved for Future Ones.
I'll check into this some more. I hadn't even thought that this would be an issue, since no moving parts!
The only thing that triggers "Exceeded_Lifetime" is a zero in those columns. Which is kinda strange; it shouldn't be that way. It might be a different version of SMART it uses.
I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

#6 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 09 May 2012 - 05:17 AM

Chimaera - Try it now and see if thats any better.

Anybody else have anomalies to report? Please do.

Updated 1st Post
I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

#7 Chimaera

Chimaera

    Sorry .. Where am i again?

  • Active Members
  • PipPipPipPipPipPip
  • 1,909 posts

Posted 09 May 2012 - 06:49 AM

Yep thats better it has values now

Thx for having a look

If Ive just helped you ... miracles do happen. Chimaera 

 

CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()


#8 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 16,858 posts

Posted 09 May 2012 - 07:25 AM

Great function ripdad, thanks for sharing.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 20/07/2014


#9 ptrex

ptrex

    Universalist

  • MVPs
  • 2,413 posts

Posted 09 May 2012 - 11:48 AM

@ripdad

good job this one runs on my machine, the first version didn't.

Rgds
ptrex

#10 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 09 May 2012 - 08:13 PM

Thanks all - I'm still working on it. Hopefully I can get other problems solved.

ptrex - I think I know what cause the 1st script to fail for you. I Assumed that an Attribute would be present in the first set of the array. I changed an IF Statement from ExitLoop to ContinueLoop, but not for your particular instance. Looks like That fixed more than one problem!

Also, I ran this on the Win7 64Bit Machine earlier And I found out that #RequireAdmin was needed to make it work on that one. You could always use "Run As Administrator" also.

---

Thought I would share this from testing that I did on an older drive. It should give you some idea of how to interpret the data.

Remember, that just because the data is This Way for This Drive, doesn't mean that the next drive will be the same way.
But... I think for this Attribute (9=POH), it's pretty much a standard (as are a few others, ie: Temperature).

This is how a Western Digital 80GB Drive would appear if it was somewhat new.

(Columns 3 and 4 have the same exact data on This Drive)

Starting at column 3 on the array...

100|100|96|0|0|0|0|0|0|PowerOnHours(POH) |   |   |  | |   |   |  Total Cycles -or- Turnovers |   |   Hours Count (this cycle) The Percentage from 100 remaining on the drive Now, some years go by and this is the result... 43|43|142|163|0|0|0|0|0|PowerOnHours(POH) |  |  |   | |  |  |   Total Cycles -or- Turnovers |  |  Hours Count (this cycle) The Percentage from 100 remaining on the drive


One could easily make a script like this, to reflect the Lifetime Remaining on a hard drive...
Local $Value = 43 GUICreate('HardDrive - Lifetime Remaining from POH', 350, 100, -1, -1) GUICtrlCreateLabel($Value & '%', 36, 37, 20, 20) Local $pb = GUICtrlCreateProgress(65, 35, 200, 20) GUICtrlSetData($pb, $Value) GUISetState() Do Until GUIGetMsg() = -3 GUIDelete()

Of course, you would get the $Value from the array at column 3 or 4 at Attribute 9.
ie: Local $Value = $aSMART[9][4]

So, If I'm reading this properly, then on this drive, the overall data in those columns would be like this:

0 = Old Age (lifetime reached) - "43" would eventually fall to zero, right?
1 = Error Flag - this would be the alert.
100 = Start Percentage Value - eventually falling over time.
200 = OK or N/A (not applicable) or Other - is the way it appears to me. Correct me, if I'm wrong.

The rest would be in threshold or data columns.

It seems that Cycles or Turnovers are at the end of 255 which carries over to the "Cycles" column as one cycle and Then starts over. I'll have to confirm all this as time goes by.

Good day all.
I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

#11 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 10 May 2012 - 08:37 AM

Okay, I pretty much confirmed the previous post which I used 2 DOS tools to determine that.
You can't get much better than off-line data results. It has tons more info than in Windows.

The calculation for POH in the previous post is:

Cycles * 256 + CurrentCycle = n PowerOnHours

ie: (163 * 256) + 142 = 41870 PowerOnHours

---

Heres another one...

I'm only covering just a few of these, so you get the idea of what your looking at.

Some drives have Extra Data, like this one for Attribute: 194 (Temperature).

(temperature values are Celsius in VSData columns)

194|34|0|100|100|33C/91F|0|14|0|53|0|0|Temperature     |    |   |     |       |    |     |    |   |     |       |    |     |    |   |     |       |    Highest Ever Temperature Recorded     |    (VS%)     |       |     |              |       Lowest Ever Temperature Recorded     |              |     |              Current Temperature     | Threshold



Heres another one that doesn't have extra data.
About the most you can get out of this, is just the current temp...


194|34|0|102|85|41C/106F|0|0|0|0|0|0|Temperature     |    |   |    |     |    |   |    |     |    |   |    |     |    (VS%)    |     |             |     |             |     |             Current Temperature     | Threshold


---

I also found the problem (or one of the problems) with WMI passing up additional or secondary drives.

Condition: The CD-ROM is Master and the Hard Drive is Slave on the secondary IDE channel.
The Fix: Swap them. (don't forget to pin them, master or slave)
I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

#12 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 11 May 2012 - 11:50 AM

Updated 1st Post

I think I'm done with this project - let me know if you experience any problems.
I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

#13 Emiel Wieldraaijer

Emiel Wieldraaijer

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 703 posts

Posted 11 May 2012 - 03:16 PM

@Ripdad

Thnx
Best regards,Emiel WieldraaijerPosted Image

#14 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 11 May 2012 - 09:56 PM

Emiel - you're welcome.

I found an oversight that needs to be corrected. That's what happens when you're on Information-Overload.

I suppose before I post the update, that I should ask if there is any particular order they want the columns.
They are now in the order as the information is obtained.

Any suggestions?

I could also add a function to auto-configure the columns to a string like this:

0|14|2|12|4|5......


--EDIT--

okay, Added Column Swap.

@ricky03 - I haven't forgotten about your request. Give me about a week or so.

Updated 1st Post

Edited by ripdad, 12 May 2012 - 05:33 AM.

I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

#15 ricky03

ricky03

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 279 posts

Posted 12 May 2012 - 08:07 AM

No problem, you aren't my own coder... ;) You have time...

#16 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,382 posts

Posted 12 May 2012 - 09:08 AM

UAC is a strange thing indeed... You can run the script locally (only) without admin privileges when you replace the WMI calls like this:
Local $objWMI = ObjGet("winmgmts:rootCIMV2")
$objWMI = ObjGet("winmgmts:rootWMI")

Edit:
And really nice script by the way ;)!

Edited by KaFu, 12 May 2012 - 09:40 AM.


#17 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 13 May 2012 - 12:59 AM

KaFu,

Well now, that is strange.

I just ran an ACL tool that "Requires Security", with the above call to WMI and it worked as though I had full privileges.
I'd say that is some kind of bug in WMI, Or is it?

Thanks for the reply.
I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

#18 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,382 posts

Posted 13 May 2012 - 10:38 AM

When I ran the script without admin privileges directly after a fresh restart, I received the error 80041003 (access denied).

Then I ran it with admin privileges and it worked fine. Then I ran it again without admin privileges and it work fine again this time too...

Seems like the first call with admin privileges pulls something into a kind of cache that can be accessed without the privileges later on, so better stick to require admin access for this script.

#19 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 13 May 2012 - 11:00 AM

Yes, that makes sense. And that's pretty much how it works. Once you've obtained the privileges for the current session, it should last until you restart the PC.

And you're right, there's no point in trying to 2nd guess it. Might as well leave it "as is", to be on the safe side.

Thanks for the input!
I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

#20 ricky03

ricky03

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 279 posts

Posted 25 June 2012 - 08:55 AM

Hello,

I use a raid system, and with this raid I have the error below :

Error_smart.PNG

It's possible to manage better the errors? Or have an information more explicit? Of course, I see this problem with the sysinfolog, but the scrypt is the same!

Here are the informations from the sysinfolog :

Spoiler


Of course, I can made a StringInStr in PNPDeviceID with the name "EASYRAID", but by request is to don't crash the soft with a raid system...

Edited by ricky03, 25 June 2012 - 08:55 AM.






Also tagged with one or more of these keywords: s.m.a.r.t.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users