I'm looking to get data such as Size/Capacity, Serial No, Model No, Heads Sectors, Manufacturer and possibly SMART data.
You can use WMI Calls to access info about the hard disks.
//Requires using System.Management; & System.Management.dll Reference
ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
disk.Get();
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes");
Console.WriteLine("Logical Disk FreeSpace = " + disk["FreeSpace"] + "bytes");
You should use the System.Management namespace:
System.Management.ManagementObjectSearcher ms =
new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
foreach (ManagementObject mo in ms.Get())
{
System.Console.Write(mo["Model");
}
For details on the members of the Win32_DiskDrive class, check out:
http://msdn.microsoft.com/en-us/library/aa394132(VS.85).aspx
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