I have SATA Hard Disk, and I want to detect by C# windows form. I want to display that it is SATA or IDE drive. I am using following code but it always return IDE but its should be return SATA. So any one can help me to where I am wrong.
WqlObjectQuery q = new WqlObjectQuery("SELECT * FROM Win32_DiskDrive");
ManagementObjectSearcher res = new ManagementObjectSearcher(q);
foreach (ManagementObject o in res.Get())
{
string lblInterface= o["InterfaceType"].ToString();
}
According to the Win32_DiskDrive
class documentation, the possible values for InterfaceType
are:
SCSI
HDC
IDE
USB
1394
Hence, you would not see SATA.
However, Caption
property may contain extra information about the drive. You can parse it to find whether it contains ATA or SCSI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With