# HWID - Unique hardware identifier¶

Unique identifier - serves for binding the agent to the system and the data that it sends to the server. An agent recieves HWID in this order:

• Serial number of the hard disk.
• If comes an error, then MAC
• If comes an error, then the serial number of the volume.

Note

Starting from the agent version 5.8.2450 and later there is a possibility to set HWID in the Windows registry, for this you need to create a value of the “REG_SZ” type.

Starting from the agent version 5.8.2450 and later there is a possibility to set HWID in the Windows registry, for this you need to create a value of the “REG_SZ” type.

[HKEY_LOCAL_MACHINE\SYSTEM\SCHWID]
«hwid»=«1111-2223»


It also makes sense to correct the HWID if the “Wrong CN!” error occurs in the agent’s log.

Edit the value of the hwid registry, excluding whitespace.

Or create a file with content (set your own HWID value according to the template XXXX-YYYY)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\SCHWID]
«hwid»=«1111-2223»


## Automatic HWID generation¶

The text below should be copied and pasted into a file, for example hwid.bat.

@echo off
reg query "HKLM\SYSTEM\SCHWID" /v "hwid" >nul
if  %errorlevel% equ 0 goto end
set I=26
set N=16
set CHAR=0 1 2 3 4 5 6 7 8 9 A B C D E F
set Hex=0
:LOOP
set /a R=1+%N%*%random%/32768
for /f "tokens=%R%" %%q in ("%CHAR%") do (set Hex=%%q%Hex%)
Set /a I-=1
If %I% GTR 0 goto LOOP
echo %Hex%

reg add HKLM\SYSTEM\SCHWID /v hwid /t REG_SZ /d %Hex%
:end


You can run this script with the command:

cmd.exe /c hwid.cmd


After that, the unique identifier will be written into the system registry and will never be able to change.