Function Reference


_WinAPI_UniqueHardwareID

Generates a unique hardware identifier (ID) for local computer

#include <WinAPIDiag.au3>
_WinAPI_UniqueHardwareID ( [$iFlags = 0] )

Parameters

$iFlags [optional] The flags that specifies what information would be used to generate ID. This parameter can be one or more of the following values.
$UHID_MB - Uses information about your motherboard. This flag is used by default regardless of whether specified or not.
$UHID_BIOS - Uses information from BIOS.
$UHID_CPU - Uses information about your processor(s). Note that $UHID_CPU flag reduces the function speed.
$UHID_HDD - Uses information about the installed hard drives. Any change in the configuration disks will change ID returned by this function. Taken into account only non-removable disks with an ATA or SATA interfaces.
$UHID_All - The sum of all the previous flags.

Return Value

Success: The string representation of the ID. @extended returns the value that contains a combination of flags
specified in the $iFlags parameter. If flag is set, appropriate information is received successfully,
otherwise fails. The function checks only flags that were specified in the $iFlags parameter.
Failure: Empty string and sets the @error flag to non-zero.

Remarks

This function uses the Windows Management Instrumentation (WMI).

Example

#include <APIDiagConstants.au3>
#include <WinAPIDiag.au3>

ConsoleWrite('Hardware1: ' & _WinAPI_UniqueHardwareID() & @CRLF)
ConsoleWrite('Hardware2: ' & _WinAPI_UniqueHardwareID(BitOR($UHID_MB, $UHID_BIOS)) & @CRLF)
ConsoleWrite('Hardware3: ' & _WinAPI_UniqueHardwareID(BitOR($UHID_MB, $UHID_BIOS, $UHID_CPU)) & @CRLF)
ConsoleWrite('Hardware4: ' & _WinAPI_UniqueHardwareID($UHID_All) & @CRLF)