I need to check in C# if a hard disk is SSD (Solid-state drive), no seek penalty? I used:
ManagementClass driveClass = new ManagementClass(\"Win32_DiskDr
This will give you the result on Win10
ManagementScope scope = new ManagementScope(@"\\.\root\microsoft\windows\storage");
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM MSFT_PhysicalDisk");
string type = "";
scope.Connect();
searcher.Scope = scope;
foreach (ManagementObject queryObj in searcher.Get())
{
switch (Convert.ToInt16(queryObj["MediaType"]))
{
case 1:
type = "Unspecified";
break;
case 3:
type = "HDD";
break;
case 4:
type = "SSD";
break;
case 5:
type = "SCM";
break;
default:
type = "Unspecified";
break;
}
}
searcher.Dispose();
P.s. the string type is the last drive, change to an array to get it for all drives