Win32_DiskDrive Signature property

后端 未结 4 2011
野的像风
野的像风 2021-02-11 07:30

Does anybody know what is the Signature property of the Win32_DiskDrive WMI class? Is it unique or users can change it like disk volume serial number?

Thanks.

4条回答
  •  旧时难觅i
    2021-02-11 08:16

    i can help you with by giving some important details about "Win32_DiskDrive WMI class".

    copy following code to your c# project.

        public static string HardDiskID()
        {
            ManagementClass partionsClass = new ManagementClass("Win32_DiskDrive");
            ManagementObjectCollection partions = partionsClass.GetInstances();
    
            string hdd = string.Empty;
    
            foreach (ManagementObject partion in partions)
            {
                hdd = Convert.ToString(partion["SerialNumber"]);
    
                if (hdd != string.Empty)
                    return hdd;
            }
    
            return hdd;
        }
    

    Note--above code's "SerialNumber" string can replace with following any hard disk attributes.

      uint16   Availability;
      uint32   BytesPerSector;
      uint16   Capabilities[];
      string   CapabilityDescriptions[];
      string   Caption;
      string   CompressionMethod;
      uint32   ConfigManagerErrorCode;
      boolean  ConfigManagerUserConfig;
      string   CreationClassName;
      uint64   DefaultBlockSize;
      string   Description;
      string   DeviceID;
      boolean  ErrorCleared;
      string   ErrorDescription;
      string   ErrorMethodology;
      string   FirmwareRevision;
      uint32   Index;
      datetime InstallDate;
      string   InterfaceType;
      uint32   LastErrorCode;
      string   Manufacturer;
      uint64   MaxBlockSize;
      uint64   MaxMediaSize;
      boolean  MediaLoaded;
      string   MediaType;
      uint64   MinBlockSize;
      string   Model;
      string   Name;
      boolean  NeedsCleaning;
      uint32   NumberOfMediaSupported;
      uint32   Partitions;
      string   PNPDeviceID;
      uint16   PowerManagementCapabilities[];
      boolean  PowerManagementSupported;
      uint32   SCSIBus;
      uint16   SCSILogicalUnit;
      uint16   SCSIPort;
      uint16   SCSITargetId;
      uint32   SectorsPerTrack;
      string   SerialNumber;
      uint32   Signature;
      uint64   Size;
      string   Status;
      uint16   StatusInfo;
      string   SystemCreationClassName;
      string   SystemName;
      uint64   TotalCylinders;
      uint32   TotalHeads;
      uint64   TotalSectors;
      uint64   TotalTracks;
      uint32   TracksPerCylinder
    

提交回复
热议问题