Jump to content

_WMI_GetATAPISmartData v1.01


ripdad
 Share

Recommended Posts

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

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

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

Anybody else have anomalies to report? Please do.

Updated 1st Post

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Great function ripdad, thanks for sharing.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_IdleTime()_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()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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.

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

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)

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Updated 1st Post

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

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

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

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

  • 1 month later...

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