WMI is good at this too, I have used it with great success.
using( ManagementClass driveClass = new ManagementClass( "Win32_DiskDrive" ) )
{
using( ManagementObjectCollection physicalDrives = driveClass.GetInstances( ) )
{
foreach( ManagementObject drive in physicalDrives )
{
string cylinders = ( string )drive["TotalCylinders"];
drive.Dispose( );
}
}
}
For a list of additional disk properties, you can use this page.
source
share