1. Introduction
In WMI, you can obtain information about a disk drive by using the Win32_DiskDrive object:
ManagementClass mc = new ManagementClass ("win32_diskdrive");
Managementobjectcollection MOC = MC. GetInstances ();
foreach (ManagementObject mo in MOC)
{
PropertyInfo = mo. Properties[propertyname]. Value.tostring ();
}
2, property name
The property name of the Win32_DiskDrive object is as follows:
Availability
BytesPerSector
Capabilities
Capabilitydescriptions
Caption
Compressionmethod
Configmanagererrorcode
Configmanageruserconfig
CreationClassName
Defaultblocksize
Description
DeviceID
Errorcleared
ErrorDescription
ErrorMethodology
Firmwarerevision
Index
InstallDate
InterfaceType
LastErrorCode
Manufacturer
Maxblocksize
Maxmediasize
medialoaded
MediaType
Minblocksize
Model
Name
Needscleaning
numberofmediasupported
Partitions
Pnpdeviceid
PowerManagementCapabilities
powermanagementsupported
SCSIBus
SCSILogicalUnit
Scsiport
SCSITargetId
Sectorspertrack
SerialNumber
Signature
Size
Status
StatusInfo
Systemcreationclassname
SystemName
Totalcylinders
Totalheads
Totalsectors
Totaltracks
trackspercylinder