DriveGet Detect SSD And Other Types

Propose new features and changes
SOTE
Posts: 1086
Joined: 15 Jun 2015, 06:21

DriveGet Detect SSD And Other Types

07 Mar 2019, 03:46

AutoHotkey should have SSD detection for DriveGet, OutputVar, Type, Path. Probably best to add a few other types too, on the detection list.

Can be important for automation scripts.
User avatar
nnnik
Posts: 4470
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: DriveGet Detect SSD And Other Types

07 Mar 2019, 04:38

Why?
Recommends AHK Studio
User avatar
jNizM
Posts: 2663
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: DriveGet Detect SSD And Other Types

07 Mar 2019, 08:15

DriveGet, Type is calling GetDriveType function. And there is no return for SSD.

If you want detect SSD you need WMI (MSFT_PhysicalDisk class)

Code: Select all

MSFT_PhysicalDisk()
{
	static DiskType := []
	static MediaType := { 0: "Unspecified", 3: "HDD", 4: "SDD", 5: "SCM" }
	try {
		for objItem in ComObjGet("winmgmts:\root\Microsoft\Windows\Storage").ExecQuery("SELECT * FROM MSFT_PhysicalDisk") {
			DiskType[A_Index, "FriendlyName"] := objItem.FriendlyName
			DiskType[A_Index, "MediaType"]    := MediaType[objItem.MediaType]
		}
		return DiskType
	}
	return ""
}

for k, v in MSFT_PhysicalDisk()
	MsgBox % v.MediaType "`n" v.FriendlyName
Minimum supported client: Windows 8
Minimum supported server: Windows Server 2012
[AHK] 1.1.32.00 x64 Unicode | [WIN] 10 Pro (Version 2004) x64 | [GitHub] Profile
Donations are appreciated if I could help you
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: DriveGet Detect SSD And Other Types

07 Mar 2019, 08:18

- @jNizM: This thread originates from this post:
Script to detect if disk is SSD or HDD - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=60878
- AutoIt's DriveGetType has functionality to check if a drive is an SDD. It checks the following criteria (and possibly more):
•Disks whose driver reports “no seek penalty”.
•Disks that report a nominal media rotation rate of 1.
- So far I've written code to check the first criterion (in the link).
- Nice to see you around. Cheers.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
SOTE
Posts: 1086
Joined: 15 Jun 2015, 06:21

Re: DriveGet Detect SSD And Other Types

07 Mar 2019, 11:23

DriveGetType in AutoIt already has this ability, sad for AutoHotkey not to.
Looks easy to implement.
Better for automation scripts to be able to identify drive or media to operate on.
User avatar
nnnik
Posts: 4470
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: DriveGet Detect SSD And Other Types

07 Mar 2019, 11:50

Yeah but it is using a bad implementation. jNizM provided working code for a new impementation.
If someone wants to add this feature please use jNizMs concept.
Recommends AHK Studio
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: DriveGet Detect SSD And Other Types

07 Mar 2019, 11:58

- The original thread warned against these 2 approaches:
•There's a way to do it in Windows Powershell - but it only works in Win 8 and up.
•Some people suggest using WMIC to get the model of the disk and see if it has "SSD" in the model number but since not all SSDs have "SSD" in the model, that's not a great solution.
- Is jNizM's approach, one of those 2 approaches?
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
nnnik
Posts: 4470
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: DriveGet Detect SSD And Other Types

07 Mar 2019, 12:09

Well if there is no way to do it without using side channels such as
•Disks whose driver reports “no seek penalty”.
•Disks that report a nominal media rotation rate of 1.
or
•Some people suggest using WMIC to get the model of the disk and see if it has "SSD" in the model number but since not all SSDs have "SSD" in the model, that's not a great solution.
qnd no way to do it for all windows versions, then there simply is no way we can offer a built in command for this.
If someone finds a reliable direct APi that explicitly states, which drives are SSD and which aren't we can add this.
Anything else just doesn't do the job.
Recommends AHK Studio

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 4 guests