Getting hard drive speed using C #

Can I get hard drive information using C #?

Like spin rate in RPM Model Number Company Name Data Transfer Rate Seek Time 

most importantly rotation speed.

I tried with

 ManagementClass driveClass = new ManagementClass("Win32_DiskDrive"); 

but it does not give rotation speed.

Please help me?

  • Dattatria Moyne
+4
source share
2 answers

Read this Win32_DiskDrive and try this:

 ArrayList hddCollection = new ArrayList(); try { var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive"); foreach (ManagementObject wmiObj in searcher.Get) { HardDrive hdd = new HardDrive(); hdd.model = wmiObj("Model").ToString; hdd.type = wmiObj("InterfaceType").ToString; hddCollection.Add(hdd); break; // TODO: might not be correct. Was : Exit For } } catch (Exception ex) { throw ex; } 
+1
source

Check this out: Reading ATAPI SMART data from disks using .NET; The temperature of any person?

 using System.Management; public string GetHDDSerial() { ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia"); foreach (ManagementObject wmi_HD in searcher.Get()) { // get the hardware serial no. if (wmi_HD["SerialNumber"] != null) return wmi_HD["SerialNumber"].ToString(); } return string.Empty; } 
+4
source

Source: https://habr.com/ru/post/1413115/


All Articles