Sign in to follow this  
Followers 0

_WMI_GetATAPISmartData v1.01


72 posts in this topic

Posted (edited)

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

_WMI_GetATAPISmartData_v1.01.au3

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
UEZ and Emiel Wieldraaijer like this

Share this post


Link to post
Share on other sites



Posted

Hello,

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

Regards

Share this post


Link to post
Share on other sites

Posted

Cool, nice to have function!

Thanks for sharing it!

Br,

UEZ

Share this post


Link to post
Share on other sites

Posted

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....

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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

Anybody else have anomalies to report? Please do.

Updated 1st Post

Share this post


Link to post
Share on other sites

Posted

Yep thats better it has values now

Thx for having a look

Share this post


Link to post
Share on other sites

Posted

Great function ripdad, thanks for sharing.

Share this post


Link to post
Share on other sites

Posted

@ripdad

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

Rgds

ptrex

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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)

Share this post


Link to post
Share on other sites

Posted

Updated 1st Post

I think I'm done with this project - let me know if you experience any problems.

Share this post


Link to post
Share on other sites

Posted

@Ripdad

Thnx

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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!

Share this post


Link to post
Share on other sites

Posted (edited)

Hello,

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

post-39014-0-60221000-1340614205_thumb.p

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 :

<--Win32_DiskDrive

(1)

BytesPerSector|512 Bytes

Capabilities|3, 4

|3=(Random Access)

|4=(Supports Writing)

Caption|ER-M2S easyRAID

ConfigManagerErrorCode|0=(This device is working properly.)

ConfigManagerUserConfig|False

Description|Disk drive

DeviceID|.PHYSICALDRIVE0

Index|0

InterfaceType|IDE

Manufacturer|(Standard disk drives)

MediaLoaded|True

MediaType|Fixed - hard disk media

Model|ER-M2S easyRAID

Name|.PHYSICALDRIVE0

Partitions|3

PNPDeviceID|IDEDISKER-M2S_EASYRAID_________________________110121.15&3B906009&0&0.0.0

FirmwareRevision|110121.1

SCSIBus|0

SCSILogicalUnit|0

SCSIPort|1

SCSITargetId|0

SectorsPerTrack|63

Signature|-254218024

Size|931.51 GB

Status|OK

TotalCylinders|121601

TotalHeads|255

TotalSectors|1953520065

TotalTracks|31008255

TracksPerCylinder|255

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0