ModemJunki Posted July 13, 2015 Share Posted July 13, 2015 Should the ability to check if a drive is an SSD even work in Windows XP?(And yes, I know it's a can of worms to look into this on XP, trust me I am only doing what I am asked to do by someone else).E.g., If I do the following:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.0 Script Function: Checks if a drive letter is an SSD drive #ce ---------------------------------------------------------------------------- #RequireAdmin #include <AutoItConstants.au3> $s_chkDrv = "E:" $s_isDrive = DriveGetType($s_chkDrv, $DT_DRIVETYPE) $s_isSSD = DriveGetType($s_chkDrv, $DT_SSDSTATUS) $s_whatBus = DriveGetType($s_chkDrv, $DT_BUSTYPE) ConsoleWrite("$s_isDrive=" & $s_isDrive & @CRLF & "$s_isSSD=" & $s_isSSD & @CRLF & "$s_whatBus=" & $s_whatBus & @CRLF) My results are as follows (and I know for certain the drive is an SSD):--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop$s_isDrive=Fixed$s_isSSD=$s_whatBus=SCSI+>12:44:17 AutoIt3.exe ended.rc:0+>12:44:17 AutoIt3Wrapper Finished.>Exit code: 0 Time: 0.4762 Always carry a towel. Link to comment Share on other sites More sharing options...
JohnOne Posted July 13, 2015 Share Posted July 13, 2015 It's a matter of luck, as I believe XP is not an officially supported language any more. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 13, 2015 Moderators Share Posted July 13, 2015 (edited) Actually, where AutoIt is concerned anyway, for the new version just released the minimum supported is XP SP3 or Server 2003 SP2. The OS itself is not supported, of course. Edited July 13, 2015 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
mikell Posted July 13, 2015 Share Posted July 13, 2015 Nice, XP is still a good petI personally use this approach which usually worksLocal $Output="" $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk", "WQL", 0x10 + 0x20) If IsObj($colItems) then For $objItem In $colItems $name = $objItem.Name If StringRight($name, 1) <> ":" Then ContinueLoop $s = ((($objItem.DiskReadBytesPersec/1024)/1024)/1024)/8 $type = ($s > 6) ? "SSD" : "No SSD" $Output &= $name & " = " & $type & " (" & $s & ")" & @CRLF Next Endif Msgbox(0,"", $Output) Link to comment Share on other sites More sharing options...
Administrators Jon Posted July 13, 2015 Administrators Share Posted July 13, 2015 Should the ability to check if a drive is an SSD even work in Windows XP?(And yes, I know it's a can of worms to look into this on XP, trust me I am only doing what I am asked to do by someone else).The function uses the two methods described here to detect SSD. https://www.autoitconsulting.com/site/scripting/detect-an-ssd-disk-using-a-script/ But the Seek Penalty test only works on Win7 and later, so on XP you're only using the rotation rate test. Basically it's not as reliable on XP. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
ModemJunki Posted July 14, 2015 Author Share Posted July 14, 2015 Thanks, everyone. I got tapped to work on XP because I'm old. :-PIn order to assure failsafe operations (and put some responsibility on the requestor), I will instead:Make a textfile with string(s) from the expected SSD model caption.Read the textfile.Query the drive caption with WMI.Compare to the string(s) from the textfile.Act accordingly (use gdisk circa 2009 to create an aligned partition if it's a matching hard disk model number). Always carry a towel. Link to comment Share on other sites More sharing options...
ModemJunki Posted July 14, 2015 Author Share Posted July 14, 2015 Nice, XP is still a good petI personally use this approach which usually worksLocal $Output="" $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk", "WQL", 0x10 + 0x20) If IsObj($colItems) then For $objItem In $colItems $name = $objItem.Name If StringRight($name, 1) <> ":" Then ContinueLoop $s = ((($objItem.DiskReadBytesPersec/1024)/1024)/1024)/8 $type = ($s > 6) ? "SSD" : "No SSD" $Output &= $name & " = " & $type & " (" & $s & ")" & @CRLF Next Endif Msgbox(0,"", $Output) I get a syntax error on this one (using 3.3.8.1, which is my production code):X:\!Dev\PixelRestore\test_drive.au3(9,24) : ERROR: syntax error (illegal character) $type = ($s > 6) ?~~~~~~~~~~~~~~~~~~~~~~~^ Always carry a towel. Link to comment Share on other sites More sharing options...
Administrators Jon Posted July 14, 2015 Administrators Share Posted July 14, 2015 If $s > 6 Then $type = "SSD" Else $type = "No SSD" EndIf Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
ModemJunki Posted July 14, 2015 Author Share Posted July 14, 2015 Interesting result - in the screenshot attached, disks 0, 1, and 2 are definitely SSDs (and X: is an USB flash device). Running on Windows 7 under 3.3.8.1., but I get similar incorrect results for the XP system.Local $Output = "" $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems $name = $objItem.name If StringRight($name, 1) <> ":" Then ContinueLoop $s = ((($objItem.DiskReadBytesPersec / 1024) / 1024) / 1024) / 8 If $s > 6 Then $type = "SSD" Else $type = "No SSD" EndIf $Output &= $name & " = " & $type & " (" & $s & ")" & @CRLF Next EndIf Msgbox(0,"", $Output) Always carry a towel. Link to comment Share on other sites More sharing options...
BrewManNH Posted July 14, 2015 Share Posted July 14, 2015 On my computer I get this.0 C: = SSD (39.0915508270264)1 F: = No SSD (0.104038298130035)2 E: = No SSD (0.00145798921585083) 0 is an SSD, running 3.3.14.0 on Windows 7 x64. 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...
ModemJunki Posted July 14, 2015 Author Share Posted July 14, 2015 (edited) With the new method in 3.3.14.0, the results are as expected (see small attached screenshot) on the same Windows 7 system (HP EliteBook 8570w)However, on another Windows 7 system (HP Z840), the results are *NOT* ok with my sample code below (new method) and I know this other system has Micron SSDs in it! Now, I know that on my home system (HP Z400 with a generic 6GB SATA controlller) the new method works.So it seems that in Windows 7 at least there can be some influence that causes this new method to produce incorrect results, but I don't know what.Is there any information I can provide that will help find the root cause, or can someone tell me where to dig? I'm very curious about this.<edit: all Windows 7 versions are 64-bit environments>#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.0 #ce ---------------------------------------------------------------------------- #include <AutoItConstants.au3> Local $Output = "" $a_allDrv = DriveGetDrive("Fixed") For $i = 1 To $a_allDrv[0] $s_isSSD = DriveGetType($a_allDrv[$i], $DT_SSDSTATUS) If $s_isSSD <> "" Then $s_foundSSD = "SSD" Else $s_foundSSD = "No SSD" EndIf $Output &= $a_allDrv[$i] & " = " & $s_foundSSD & @CRLF Next MsgBox(0, "", $Output) Edited July 14, 2015 by ModemJunki add info about Windows being x64 Always carry a towel. Link to comment Share on other sites More sharing options...
trancexx Posted July 14, 2015 Share Posted July 14, 2015 There is no safe method to detect SSD type of drive, nor there will be until manufacturers would be forced to "mark" them as such by some future standard. That will never happen though. Extending built-in function in this manner was mistake. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Iczer Posted July 14, 2015 Share Posted July 14, 2015 if someone can make some function to read S.M.A.R.T. and other info from drives - problem would be as good as solved, i think. Link to comment Share on other sites More sharing options...
ModemJunki Posted July 14, 2015 Author Share Posted July 14, 2015 if someone can make some function to read S.M.A.R.T. and other info from drives - problem would be as good as solved, i think. Look at the link in Jons post (#5), there is comment there about a tool that works with SMART. But this is not the answer - no standard exists to report the drive is SSD, mechanical, or hybrid.I'm out of luck. I will stick with a textfile and some specific models defined inside. My requestor will have real work to do keeping the file up to date in his distribution - I know thats crazy talk. :-) Always carry a towel. 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