Win32_DiskDrive Signature property

2019-04-02 08:47发布

问题:

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.

回答1:

The "Signature" property was introduced with Windows XP and is used for disks that are used as shared cluster disks. In my understanding it is created the first time the disk is connected to a windows system and will not be changed even if the disk is connected via another controller (or in a cluster scenario even via another computer).

For a detailed explanation see MSDN: Creating Physical Disk Resources http://msdn.microsoft.com/en-us/library/aa369328(VS.85).aspx



回答2:

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


回答3:

I take HDD to another machine and Signature and PNPDeviceID CHANGED. So i think OS generates this signature.



回答4:

Two comments that I think are very important for anyone following this path.

  • It can be changed using the diskpart tool
  • It is not reliable to access it via Signature - see Random value for disk Signature


标签: wmi