1、簡介
在WMI中,通過Win32_DiskDrive對象可以擷取磁碟機的相關資訊:
ManagementClass mc = new ManagementClass("Win32_DiskDrive");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
propertyInfo = mo.Properties[PropertyName].Value.ToString();
}
2、屬性名稱
Win32_DiskDrive對象的屬性名稱如下:
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