As many who use virtual machines for testing, I often need to reinstall the same. One thing that annoys me when getting Windows reinstalled is the prompt for the product key. Yes, you can bypass it temporarily but you still need to enter it when you go and activate the Windows. My laptop has product key embedded in BIOs. Why cannot I do the same with virtual machine? Well, maybe I can.
Investigation started by looking into where exactly the key is located on physical hardware. It was relatively easy to discover this was in ACPI MSDM table. Microsoft even has instructions on how to create the table. If you look a bit further, you can even find description on the MSDM fields.
|4||4||Length||Total length is always
|9||1||Checksum||Checksum over the whole table.|
|10||6||OEM ID||Anything goes; pad with spaces.|
|16||8||OEM Table ID||Anything goes albeit ASCII text is customary.|
|24||4||OEM Revision||Any number will do but keep it positive (little-endian).|
|28||4||Creator ID||Anything goes; pad with spaces.|
|32||4||Creator Revision||Any number will do but keep it positive (little-endian).|
|56||29||Product key||Product key with dashes included.|
It was relatively easy to figure what goes in which field except for the checksum. I didn't find which checksum method it uses but realistically there are only two when you have a 8-bit checksum. Either it's CRC or a simple sum of all fields. Well, it was a sum for this one. No matter what, sum of all fields has to be
0. If all fields except for checksum would count up to
250, the checksum would need to be
6 in order to overflow to
0. Actually a trivial thing to calculate.
With the file generated, it's easy to add it to the VirtualBox VM.
vboxmanage setextradata "VM" "VBoxInternal/Devices/acpi/0/Config/CustomTable" /msdm_table.dat
Now your Windows 10 installation can proceed with the product key pre-entered and only activation pending.
PS: This just automatically fills product key during install. You still need to do the activation. This will NOT work with the pirated key.
PPS: Yes, this is essentially the same thing as adding
PID.txt to the installation media. The same result but without media modification.
PPPS: And yes, of course I made a generator.