ripdad Posted June 25, 2012 Author Share Posted June 25, 2012 ricky03, Script Line: -1, indicates that the program is compiled. Can you run the script and post back the line number? "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 More sharing options...
rodent1 Posted June 25, 2012 Share Posted June 25, 2012 (edited) on my machine, I get error 8004100c on line 162 "For $objItem In $objClass", this means that though $objClass is an object (it passed through line 160 "If @error Or Not IsObj($objClass) Then Return SetError(-5)", it has no items to assign to $objitem. The OS is win 2008 R1. The hard drive is SCSI, which might change things. I ran the compiled script as administrator. Has anyone seen this behavior? Ideas? Thanks Edited June 25, 2012 by rodent1 Link to comment Share on other sites More sharing options...
BrewManNH Posted June 25, 2012 Share Posted June 25, 2012 I believe that as a general rule RAIDed drives won't send SMART data back to the system, or at least can't be read by the system because the RAID controller gets that data. If the drives aren't in a RAID array, it might be any number of reasons you can't read it, the BIOS isn't set up to read it for example or has been set to disable SMART monitoring. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
ripdad Posted June 25, 2012 Author Share Posted June 25, 2012 (edited) rodent1,According to MSDN, 0x8004100C = Feature or operation is not supported.I suppose that RAID has the same issues as USB drives, pretty much as BrewManNH described in the above post.The query to get SMART info from it's host controller most likely will fail because it has another set of routines it uses so that the RAID controller can talk to the motherboard controller. Unfortunately, in most cases, it won't pass SMART Data through it's interface.Some manufacturers have special software that can obtain that data. You might want to drop them an email, if needed.You can find the WMI Error Codes here at MSDN Edited June 25, 2012 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 More sharing options...
ricky Posted June 26, 2012 Share Posted June 26, 2012 ricky03,Script Line: -1, indicates that the program is compiled. Can you run the script and post back the line number?Here are the info :Error Number: 8004100CScript Line : 165It's the same as rodent1. But is possible to return a message but not crash the function? Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted June 26, 2012 Share Posted June 26, 2012 I can tell you from experience that hard drive live is a statiscal number with an extremely huge deviation from the mean. Meaning a a make of a drive at "normal" use is expected to last 5 years, but drives of the same manufacturing line may last one year, or may last 20 years. I can't find it now, but I read a white paper about googles experience with handling hard drives regarding life span and expecting failure. Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
ripdad Posted June 26, 2012 Author Share Posted June 26, 2012 ricky03, it shouldn't be crashing. the error message is from the "error handler". the behavior of it shows the message then returns an error, at which the function returns as well. unless i'm missing something here... since there is nothing more to do, it's just simply ending. "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 More sharing options...
Willia84 Posted June 28, 2012 Share Posted June 28, 2012 Hei, I am trying to detect if the disk is an ssd or not.Is there any specific attribute in the SMART that can let me know.I am thinking that spin-up time for SSD should be 0 or close to 0, but that is not the caseInhttp://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/704db4ae-5646-4f59-b39b-241a666a5e0dOne people say that they are testing it using SSD and interestingly the SpinUpTime is 181.Is ir true?I was expecting it to 0 or close to 0.Thanks!! Link to comment Share on other sites More sharing options...
ripdad Posted June 28, 2012 Author Share Posted June 28, 2012 Willia84, It should be simple to detect if a drive is an SSD by the attribute numbers 170 thru 179 when queried. I don't have the answer, but I'm with you on the spin up time. It should be showing near zero. It could be they are using that attribute for other data instead. "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 More sharing options...
Gregor1806 Posted July 14, 2012 Share Posted July 14, 2012 Hi ripdad, Sorry to be a numpty, but I've looked through your code so many times and I just can't fathom out how to make it only read the attribute numbers 170 through 179 (i.e. to determine if the drive is an SSD) - man it's array central in there!!! Is there any chance you could give me a clue how I could use your function to query those specific attributes? Also, is it safe to assume that the way this function works (looks like it's based on checking the system's S.M.A.R.T. HDD info) will work on all machines? Or does S.M.A.R.T. need to be enabled in the system BIOS in order to obtain the right results? If so, what happens if S.M.A.R.T. is not enabled? Does it not work at all or does it return strange results? Really great work on this function by the way, looks very powerful - if I could only understand how to make it work ;-) Many thanks, Gregor Link to comment Share on other sites More sharing options...
ripdad Posted July 14, 2012 Author Share Posted July 14, 2012 Updated to v0.8: Added SSD Attribute Detection and code to deal with unknown attributes.Gregor1806,1) On machines that have the option to turn S.M.A.R.T off... it must be enabled to use this script.2) You should get an message from the "error handler" if not enabled. Don't really know for sure as I haven't run across it yet.Thanks and you're welcome! "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 More sharing options...
Gregor1806 Posted July 16, 2012 Share Posted July 16, 2012 Hi ripdad, OK, first thing to say is thanks so much for listening and taking the time to rapidly amend your script to suit what I was asking for!!! Really appreciate your support! I downloaded your amended script and tested it on my machine at home yesterday. I'm running W7 x64 Ultimate with an OCZ Vertex SSD. I amended your script to just display a msgbox in the code section you added that is supposed to run when an SSD is detected. However, nothing showed up? Not sure if I'm doing something wrong - but I believe you said the script should error out if S.M.A.R.T. is not enabled (so I'm assuming it must be on that machine?). Would I need to compile the script as an x64 file? Any ideas are greatly welcomed :-) Kind regards, Gregor Link to comment Share on other sites More sharing options...
ripdad Posted July 16, 2012 Author Share Posted July 16, 2012 (edited) Gregor1806, It should not matter if it's ran in x32 or x64. Unless someone purposely disabled S.M.A.R.T in the Bios, it should be enabled by default. I have been playing with another script -- a smaller and different variant of _WMI_GetATAPISmartData(). It's called: _WMI_GetDriveList() It shows an array of drives; and if an SSD is detected, you'll see it in the last column if the value is greater than zero. Give it a try and let me know the results. expandcollapse popup; _WMI_GetDriveList.au3 - Version: 0.3b ; Released: July 16, 2012 by ripdad ; Last Modified: July 18, 2012 ; #include 'array.au3' ; #RequireAdmin ; Opt('MustDeclareVars', 1) Opt('TrayAutoPause', 0) ; Local $oErrorHandler = ObjEvent('AutoIt.Error', '_ObjErrorHandler') ; Local $array = _WMI_GetDriveList() If Not @error Then _ArrayDisplay($array) Exit ; Func _WMI_GetDriveList() Local $objWMI = ObjGet('Winmgmts:{ImpersonationLevel=Impersonate,AuthenticationLevel=PktPrivacy,(Debug)}!.rootCIMV2') If @error Or Not IsObj($objWMI) Then Return SetError(-1) Local $aDriveList[20][7] = [[20, 'DeviceID', 'SerialNumber', 'Signature', 'Size', 'FreeSpace', 'SSD_Attributes']] Local $count, $sInstanceName, $string, $sPNPDeviceID, $SSD_Detected Local $aVendorSpecific, $nDevice = -1, $n = 0 Local $objClass = $objWMI.InstancesOf('Win32_DiskDrive') $count = $objClass.Count If @error Or Not $count Then Return SetError(-2) For $objItem In $objClass $n += 1 $aDriveList[$n][0] = $objItem.Model $aDriveList[$n][1] = $objItem.DeviceID $aDriveList[$n][3] = $objItem.Signature $aDriveList[$n][4] = GetByteFormat($objItem.Size) $aDriveList[$n][6] = $objItem.PNPDeviceID Next $aDriveList[0][0] = $n ReDim $aDriveList[$n + 1][7] $n = 0 $objClass = $objWMI.InstancesOf('Win32_LogicalDiskToPartition') $count = $objClass.Count If @error Or Not $count Then Return SetError(-3) For $objItem In $objClass; Match DeviceID to Drive Letter $string = $objItem.Antecedent $string = StringRegExpReplace($string, '.*#(d),.*', '1') If ($string <> $nDevice) Then; Else, drive already processed $nDevice = $string $n += 1 If $n > $aDriveList[0][0] Then ExitLoop; just in case EndIf If StringRight($aDriveList[$n][1], 1) = $nDevice Then $string = $objItem.Dependent $aDriveList[$n][1] &= '=' & StringRight($string, 4) EndIf EndIf Next $objClass = $objWMI.InstancesOf('Win32_LogicalDisk') $count = $objClass.Count If @error Or Not $count Then Return SetError(-4) For $objItem In $objClass; Match Drive Letter for Serial Number and Free Space For $i = 1 To $aDriveList[0][0] If $objItem.DeviceID = StringLeft(StringRight($aDriveList[$i][1], 3), 2) Then $aDriveList[$i][2] = $objItem.VolumeSerialNumber $aDriveList[$i][5] = GetByteFormat($objItem.FreeSpace) EndIf Next Next $objWMI = ObjGet('Winmgmts:{ImpersonationLevel=Impersonate,AuthenticationLevel=PktPrivacy,(Debug)}!.rootWMI') If @error Or Not IsObj($objWMI) Then Return SetError(-5) $objClass = $objWMI.InstancesOf('MSStorageDriver_ATAPISmartData') $count = $objClass.Count If @error Or Not $count Then Return SetError(-6) For $objItem In $objClass $aVendorSpecific = $objItem.VendorSpecific If Not IsArray($aVendorSpecific) Then ContinueLoop $sInstanceName = $objItem.InstanceName For $i = 1 To $aDriveList[0][0] $sPNPDeviceID = StringLeft($aDriveList[$i][6], StringLen($aDriveList[$i][6]) - 5) If Not $sPNPDeviceID Then ContinueLoop $SSD_Detected = 0 If StringInStr($sInstanceName, $sPNPDeviceID) Then For $j = 2 To (UBound($aVendorSpecific) - 1) Step 12 ; SSD Attribute Detection ;======================================================== If StringRegExp($aVendorSpecific[$j], '(17[0-9])') Then $SSD_Detected += 1 EndIf ;======================================================== Next $aDriveList[$i][6] = $SSD_Detected EndIf Next Next For $i = 1 To $aDriveList[0][0] If Not StringIsDigit($aDriveList[$i][6]) Then $aDriveList[$i][6] = 0 EndIf Next Return $aDriveList EndFunc ; Func GetByteFormat($n_b, $ns_os = 1); $ns_os can be number or string, within scope of function. If Not StringIsDigit($ns_os) Then $ns_os = UBound(StringRegExp($ns_os, '(?i)(Bytes)|(KiloBytes)|(MegaBytes)', 3)) EndIf Local $a_ab = StringSplit('Bytes|KB|MB|GB|TB', '|') If ($ns_os < 1) Or ($ns_os > $a_ab[0]) Then Return $n_b For $i = $ns_os To $a_ab[0]; in @ offset -> div -> abrv -> out If ($n_b < 1024) Then Return Round($n_b, 2) & ' ' & $a_ab[$i] $n_b /= 1024 Next EndFunc ; Func _ObjErrorHandler() If Not IsObj($oErrorHandler) Then MsgBox(8240, ' Object Error', '$oErrorHandler is not an object!') Exit EndIf ; Local $AOE1 = $oErrorHandler.Description Local $AOE2 = $oErrorHandler.WinDescription Local $AOE3 = $oErrorHandler.Number Local $AOE4 = $oErrorHandler.Source Local $AOE5 = $oErrorHandler.ScriptLine ; $oErrorHandler.Clear ; Local $eMsg = '' ; If $AOE1 Then $eMsg &= 'Description: ' & $AOE1 & @TAB & @CRLF If $AOE2 Then $eMsg &= 'WinDesciption: ' & $AOE2 & @TAB & @CRLF If $AOE3 Then $eMsg &= 'Error Number: ' & Hex($AOE3, 8) & @TAB & @CRLF If $AOE4 Then $eMsg &= 'Source Name: ' & $AOE4 & @TAB & @CRLF If $AOE5 Then $eMsg &= 'Script Line: ' & $AOE5 & @TAB & @CRLF ; If $eMsg Then MsgBox(8240, ' Object Error', $eMsg, 10) Else MsgBox(8240, ' Object Error', 'Unknown Error', 10) EndIf Return SetError(-1) EndFunc ; -Edit - 1-still experimental -- updated above script to v0.2 2-updated above script to v0.3 (replace error detection) 3-updated above script to v0.3a (minor correction) 4-updated above script to v0.3b (minor adjustments) -Edit2 fixed forum formatting issue Edited November 1, 2012 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 More sharing options...
Chimaera Posted July 16, 2012 Share Posted July 16, 2012 That last column gives me 4 whether the drive is SSD or not and no serial numbers and no free space are shown If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
ripdad Posted July 16, 2012 Author Share Posted July 16, 2012 Chimaera, Might be some SRE troubles or something with the DeviceID. The script works as expected on my XP Pro. I'll have to fire up the Win7 x64 and run some test on it. But ... later after I have a nap. P.S. Could you please post or PM from SysInfoLog the data for Win32_DiskDrive and Win32_LogicalDisk? Thanks. "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 More sharing options...
Chimaera Posted July 16, 2012 Share Posted July 16, 2012 here you go m8 Win 7 Ultimate 64 bit expandcollapse popup<--Win32_DiskDrive (1) BytesPerSector|512 Bytes Capabilities|3, 4, 10 |3=(Random Access) |4=(Supports Writing) |10=(SMART Notification) CapabilityDescriptions|Random Access, Supports Writing, SMART Notification Caption|Hitachi HDT721010SLA360 ATA Device ConfigManagerErrorCode|0=(This device is working properly.) ConfigManagerUserConfig|False Description|Disk drive DeviceID|\\.\PHYSICALDRIVE1 FirmwareRevision|ST6OA3AA Index|1 InterfaceType|IDE Manufacturer|(Standard disk drives) MediaLoaded|True MediaType|Fixed hard disk media Model|Hitachi HDT721010SLA360 ATA Device Name|\\.\PHYSICALDRIVE1 Partitions|2 PNPDeviceID|IDE\DISKHITACHI_HDT721010SLA360_________________ST6OA3AA\5&7555648&0&0.1.0 SCSIBus|0 SCSILogicalUnit|0 SCSIPort|2 SCSITargetId|1 SectorsPerTrack|63 SerialNumber|202020202020545336463730534d323030424b4e Signature|2121375575 Size|931.51 GB Status|OK TotalCylinders|121601 TotalHeads|255 TotalSectors|1953520065 TotalTracks|31008255 TracksPerCylinder|255 (2) BytesPerSector|512 Bytes Capabilities|3, 4, 10 |3=(Encryption) |4=(Compression) |10=(Predismount Eject Not Required) CapabilityDescriptions|Random Access, Supports Writing, SMART Notification Caption|OCZ-VERTEX2 ATA Device ConfigManagerErrorCode|0=(This device is working properly.) ConfigManagerUserConfig|False Description|Disk drive DeviceID|\\.\PHYSICALDRIVE2 FirmwareRevision|1.27 Index|2 InterfaceType|IDE Manufacturer|(Standard disk drives) MediaLoaded|True MediaType|Fixed hard disk media Model|OCZ-VERTEX2 ATA Device Name|\\.\PHYSICALDRIVE2 Partitions|1 PNPDeviceID|IDE\DISKOCZ-VERTEX2_____________________________1.27____\5&33209AFE&0&1.0.0 SCSIBus|1 SCSILogicalUnit|0 SCSIPort|3 SCSITargetId|0 SectorsPerTrack|63 SerialNumber|434f2d5a52564e49513447365430353358453139 Signature|590825493 Size|111.79 GB Status|OK TotalCylinders|14593 TotalHeads|255 TotalSectors|234436545 TotalTracks|3721215 TracksPerCylinder|255 (3) BytesPerSector|512 Bytes Capabilities|3, 4, 10 |3=(Encryption) |4=(Compression) |10=(Predismount Eject Not Required) CapabilityDescriptions|Random Access, Supports Writing, SMART Notification Caption|ST3320310CS ATA Device ConfigManagerErrorCode|0=(This device is working properly.) ConfigManagerUserConfig|False Description|Disk drive DeviceID|\\.\PHYSICALDRIVE0 FirmwareRevision|SC1A Index|0 InterfaceType|IDE Manufacturer|(Standard disk drives) MediaLoaded|True MediaType|Fixed hard disk media Model|ST3320310CS ATA Device Name|\\.\PHYSICALDRIVE0 Partitions|1 PNPDeviceID|IDE\DISKST3320310CS_____________________________SC1A____\5&7555648&0&0.0.0 SCSIBus|0 SCSILogicalUnit|0 SCSIPort|2 SCSITargetId|0 SectorsPerTrack|63 SerialNumber|2020202020202020202020205439325839454554 Signature|-703835834 Size|298.09 GB Status|OK TotalCylinders|38913 TotalHeads|255 TotalSectors|625137345 TotalTracks|9922815 TracksPerCylinder|255 <--Win32_LogicalDisk (1) Access|0=(Unknown) Caption|C: Compressed|False Description|Local Fixed Disk DeviceID|C: DriveType|3=(Local Disk) FileSystem|NTFS FreeSpace|30.8 GB MaximumComponentLength|255 MediaType|12=(Fixed hard disk media) Name|C: QuotasDisabled|True QuotasIncomplete|True QuotasRebuilding|False Size|111.79 GB SupportsDiskQuotas|True SupportsFileBasedCompression|True VolumeDirty|False VolumeSerialNumber|E8CFEAFF (2) Access|0=(Unknown) Caption|D: Compressed|False Description|Local Fixed Disk DeviceID|D: DriveType|3=(Local Disk) FileSystem|NTFS FreeSpace|281.92 GB MaximumComponentLength|255 MediaType|12=(Fixed hard disk media) Name|D: QuotasDisabled|True QuotasIncomplete|False QuotasRebuilding|False Size|781.25 GB SupportsDiskQuotas|True SupportsFileBasedCompression|True VolumeDirty|False VolumeName|STORAGE VolumeSerialNumber|D4B0AE04 (3) Access|0=(Unknown) Caption|E: Compressed|False Description|Local Fixed Disk DeviceID|E: DriveType|3=(Local Disk) FileSystem|NTFS FreeSpace|87.59 GB MaximumComponentLength|255 MediaType|12=(Fixed hard disk media) Name|E: QuotasDisabled|True QuotasIncomplete|False QuotasRebuilding|False Size|150.26 GB SupportsDiskQuotas|True SupportsFileBasedCompression|True VolumeDirty|False VolumeName|DOWNLOADS VolumeSerialNumber|AEBC47EE (4) Caption|G: Description|CD-ROM Disc DeviceID|G: DriveType|5=(Compact Disc) MediaType|11=(Removable media other than floppy) Name|G: (5) Caption|H: Description|CD-ROM Disc DeviceID|H: DriveType|5=(Compact Disc) MediaType|11=(Removable media other than floppy) Name|H: (6) Access|0=(Unknown) Caption|Z: Compressed|False Description|Local Fixed Disk DeviceID|Z: DriveType|3=(Local Disk) FileSystem|NTFS FreeSpace|261.4 GB MaximumComponentLength|255 MediaType|12=(Fixed hard disk media) Name|Z: QuotasDisabled|True QuotasIncomplete|False QuotasRebuilding|False Size|298.09 GB SupportsDiskQuotas|True SupportsFileBasedCompression|True VolumeDirty|False VolumeName|BACKUP_DRIVE_1.2.12 VolumeSerialNumber|0C51E74E The OCZ-VERTEX2 is the SSD Drive If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
Gregor1806 Posted July 16, 2012 Share Posted July 16, 2012 Hi ripdad, Thanks for creating the _WMI_GetDriveList() function! I've tested it here on the same machine with an SSD, and it shows up the correct columns with more info that it seems to for Chimera - however even though this machine has an SSD (OCZ Vertex), it's still showing 0 in the SSD column. Am I doing something wrong? Thanks, Gregor Link to comment Share on other sites More sharing options...
ripdad Posted July 16, 2012 Author Share Posted July 16, 2012 Chimaera, Thanks. Gregor1806, Does _WMI_GetATAPISmartData (the script in Post #1), work for you at all? You should see an array of SMART Data. If you can see the array, then SMART is enabled and WMI is working correctly on your PC. After that, it's a matter of working out some flaws in the script. I tested _WMI_GetDriveList() on the Win7 x64 machine and found some anomalies (of course), and a few other things. It has been updated in Post #33. Hopefully, it will solve a few 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 More sharing options...
ripdad Posted July 18, 2012 Author Share Posted July 18, 2012 (edited) I found a bug when trying to catch errors from WMI.Seems this is working, depending on certain conditions -- which is not good enough...$objClass = $objWMI.InstancesOf('Win32_DiskDrive'); <-- example If @error Or Not IsObj($objClass) Then Return SetError(-2)So, I came up with this to replace it...$objClass = $objWMI.InstancesOf('Win32_DiskDrive'); <-- example $count = $objClass.Count If @error Or Not $count Then Return SetError(-2)This should be alot of help in catching those that get by the previous one.I will probably re-arrange the statement, depending on the class.Post #33 has been updated again, which includes this and one other thing.Feedback on whether it's working for you or not, is appreciated.--Edit--I've added a Reproducer below, to prove my point in the above.expandcollapse popupLocal $oErrorHandler = ObjEvent('AutoIt.Error', '_ObjErrorHandler') ; Small Reproducer (1 Example) ; Test if Class exist -- which should get a message from the "error handler" if not. MsgBox(0, '', 'Entering: _WMI_Test_1') _WMI_Test_1() MsgBox(0, '', 'Entering: _WMI_Test_2') _WMI_Test_2() Func _WMI_Test_1() Local $objWMI = ObjGet('Winmgmts:rootCIMV2') If @error Or Not IsObj($objWMI) Then Return SetError(-1) Local $objClass = $objWMI.InstancesOf('Win32_DiskDriv');<-- miss-spelled If @error Or Not IsObj($objClass) Then Return SetError(-2) MsgBox(0, '_WMI_Test_1', 'This Slipped By!') EndFunc Func _WMI_Test_2() Local $objWMI = ObjGet('Winmgmts:rootCIMV2') If @error Or Not IsObj($objWMI) Then Return SetError(-1) Local $objClass = $objWMI.InstancesOf('Win32_DiskDriv');<-- miss-spelled Local $count = $objClass.Count If @error Or Not $count Then Return SetError(-2) MsgBox(0, '_WMI_Test_2', 'This Slipped By!') EndFunc ; Func _ObjErrorHandler() If Not IsObj($oErrorHandler) Then MsgBox(8240, ' Object Error', '$oErrorHandler is not an object!') Exit EndIf ; Local $AOE1 = $oErrorHandler.Description Local $AOE2 = $oErrorHandler.WinDescription Local $AOE3 = $oErrorHandler.Number Local $AOE4 = $oErrorHandler.Source Local $AOE5 = $oErrorHandler.ScriptLine ; $oErrorHandler.Clear ; Local $eMsg = '' ; If $AOE1 Then $eMsg &= 'Description: ' & $AOE1 & @TAB & @CRLF If $AOE2 Then $eMsg &= 'WinDesciption: ' & $AOE2 & @TAB & @CRLF If $AOE3 Then $eMsg &= 'Error Number: ' & Hex($AOE3, 8) & @TAB & @CRLF If $AOE4 Then $eMsg &= 'Source Name: ' & $AOE4 & @TAB & @CRLF If $AOE5 Then $eMsg &= 'Script Line: ' & $AOE5 & @TAB & @CRLF ; If $eMsg Then MsgBox(8240, ' Object Error', $eMsg, 10) Else MsgBox(8240, ' Object Error', 'Unknown Error', 10) EndIf Return SetError(-1) EndFunc ;-edit-fixed forum formatting issue Edited November 1, 2012 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 More sharing options...
Gregor1806 Posted July 19, 2012 Share Posted July 19, 2012 Hi ripdad, Sorry to report that the _WMI_GetDriveList() script is still not detecting my SSD. I assume if it is successfully detecting the SSD, the entry in the last column should show a 1 - whereas on my machine it's showing with a 0. I tested your reproducer script (not quite sure what that was for??) and the first function displays the "this slipped by" msgbox - whereas the second function displays an error handled error message: Object Error Invalid class etc. Is there anything more you need from my machine to help with script debugging? Logs or something?? Thanks, Gregor 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