HardwareID element

The HardwareID element specifies a unique identifier for a hardware function of the device specified within the device metadata package.




There are no attributes.

Text value

A string that contains between 1 to 207 printable characters.

Child elements

There are no child elements.

Parent elements

Element Description


The HardwareIDList element specifies one or more HardwareID elements for each hardware function supported by the device that is specified within the device metadata package.


<xs:element name="HardwareID" type="tns:HardwareIDType" maxOccurs="unbounded" />

  <xs:simpleType name="HardwareIDType">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
      <xs:maxLength value="207" />
      <xs:pattern value="^([a-zA-Z0-9!#$%&amp;()*+\-./:;&lt;=&gt;?@[\\\]^_`{|}~])*$" />


The value of the HardwareID element consists of:

  • A "DOID:' prefix if the hardware ID is for a display object.

  • A "SFDOID:' prefix if the hardware ID is for a single-function display object.

    Note The SFDOID prefix is not supported in Windows 7, and is reserved for later versions of Windows.

  • A hardware ID in the format discussed in Device Identification Strings.

    For example, a hardware ID for a USB device would follow these rules:


    where v(4) is the 4-digit vendor code that the USB committee assigns to the vendor, d(4) is the 4-digit product code that the vendor assigns to the device, and r(4) is the revision code.

    For USB devices, the hardware ID can also be formatted based on the conventions discussed in Identifiers for USB Devices.

    Note Only identifiers in the format that is defined for hardware IDs must be specified through the HardwareID element

The operating system ignores a HardwareID element value that contains one or more of the following characters:

  • A character that has a value that is greater than 0x00 and less than or equal to 0x20 (' ': space).
  • A character that has a value that is greater than 0x7F.
  • The comma (,) character.
  • The double-quotation mark (") character.
  • The single-quotation mark (') character.

Note When you specify a HardwareID value, you must correctly encode the ampersand (&) character in the XML value. This and other special characters must be encoded in XML to ensure that the file is correctly parsed. For the ampersand character, the XML encoding value is &amp. For a complete list of XML encoding values for special characters, see Special Characters on the MSDN website.

More than one HardwareID element can specify a device. For example, consider a single-function USB printer from the company Contoso, Ltd. The following HardwareID elements can define the device:


Important You must ensure that each HardwareID element that is specified within the metadata package has a value that accurately correlates to the Hardware ID that is reported by the physical device. For example, if a hardware ID is reused across a family of physical devices, the device metadata package that specifies that HardwareID element value would be associated with the entire family of devices.

The following points discuss HardwareID usage for certain devices:

  • The hardware ID for the computer can be specified in a HardwareID element. The ComputerHardwareIds tool (ComputerHardwareIds.exe) must be used to identify the hardware IDs for the computer. When the tool runs, it creates up to seven unique hardware IDs for the computer based on information that is present in the System Management BIOS (SMBIOS) for the system. For more information about these hardware IDs, together with guidelines for selecting the appropriate hardware IDs for the computer, see ComputerHardwareIds.

    To specify that the hardware ID is for a computer, use the following rules:

    • Delimit the hardware ID GUID with'{' and '}' characters.
    • Add the prefix 'ComputerMetadata\' in front of the hardware ID GUID.

    The following is an example of a HardwareID element for the computer.

  • To specify hardware IDs for a Bluetooth device, the device must support the Device Identification (DID) Profile. Otherwise, the operating system cannot select and load the most appropriate device metadata package for the Bluetooth device. We strongly recommend that all Bluetooth devices support the DID profile.

    For more information about DID Profile, refer to the Bluetooth Device Identification Profile specification version 1.3.

    For information about supporting Bluetooth Low Energy (LE) Device IDs, refer to the Device Information Service version 1.1.

For best practices on creating hardware IDs, see Best Practices for Specifying Hardware IDs.

The HardwareID element is required if the HardwareIDList element is specified in the PackageInfo XML data.

See also

Device Identification Strings

Device Metadata Packages

Hardware IDs


Identifiers for USB Devices

Send comments about this topic to Microsoft