querying disk type

For a similar c++ wmi based code see driveinfo

fire up a powershell window and execute following command:

1
2
3
4
5
6
7
C:\Users\sarangb> Get-PhysicalDisk | Select FriendlyName, MediaType

FriendlyName            MediaType
------------            ---------
WDC WD10EZEX-00ZF5A0    Unspecified
OCZ-ARC100              SSD
Hitachi HTS545050B9A302 HDD

Note: this will not work with powershell core (as of 6.0 version)