Detect if a Disk is SSD?

Started by mcjathan, November 12, 2019, 11:42:42 AM

Previous topic - Next topic

mcjathan

Greetings,

Is there any way within a Winbatch script to detect if a disk is an SSD?  I've looked at both DiskInfo and DiskVolInfo, and also searched this forum and the tech database, and I'm not seeing it.

Suggestions?

Jeff

morenos1

Powershell?:

Get-PhysicalDisk | Select FriendlyName, MediaType

td

Powershell is just using WMI so you could also get the information using WinBatch.

Code (winbatch) Select
objWMIService = ObjectGet("winmgmts:{impersonationLevel=impersonate}!\\.\ROOT\Microsoft\Windows\Storage")

; MediaType is stored as an integer where 4 = SSD
strQuery = "SELECT * FROM MSFT_PhysicalDisk WHERE MediaType = 4"
colDisks = objWMIService.ExecQuery( strQuery )     
ForEach objDisk in colDisks
   Pause('Drive ':objDisk.FriendlyName, 'MediaType ':objDisk.MediaType)
Next


The media types are:
Value    Meaning

0          Unspecified
3              HDD
4              SSD
5             SCM
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

mcjathan


td

Here is a link to the WMI class's complete description.  (You can ignore the dire warning histrionics at the top of the page. WMI isn't going anywhere and is more or less self-documenting.)

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/stormgmt/msft-physicaldisk
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade