You won’t find a single one-liner in Linux that “just reads” your Win10 key the way chntpw resets passwords, but it’s actually pretty straightforward to pull the key out of the off-line registry hive and decode it yourself. Below are two approaches:
- Extract the embedded OEM key straight from UEFI (if your machine came with an OEM-sticker key)
- Pull the DigitalProductId from the SOFTWARE hive and run a tiny decoder script
1) If it’s an OEM key in firmware (MSDM table)
Many modern OEM PCs store the Windows key in the motherboard’s ACPI MSDM table. From a Linux live-CD you can often just do:
# mount your EFI-booted Linux, then:
strings /sys/firmware/acpi/tables/MSDM 2>/dev/null | grep -E '[A-Z0-9]{5}(-[A-Z0-9]{5}){4}'
If that file exists you’ll see your 5×5 key right there.
2) Extracting the key from the SOFTWARE hive
Step A) Mount the Windows partition and grab the hive
sudo mkdir /mnt/win
sudo mount /dev/sdXY /mnt/win # replace sdXY with your Windows volume
cp /mnt/win/Windows/System32/config/SOFTWARE ~/SOFTWARE.hive
Step B) Decode it with a tiny Python script
-
Install prerequisites:
sudo apt update
sudo apt install python3-pip
pip3 install python-registry
-
Create a file get_w10_key.py with the following contents:
#!/usr/bin/env python3
from Registry import Registry
DIGITS = "BCDFGHJKMPQRTVWXY2346789"
def decode_product_key(dpid: bytes) -> str:
# Windows stores the key starting at offset 52 in the DigitalProductId
key_offset = 52
raw = list(dpid[key_offset:key_offset+15])
decoded_chars = []
for i in range(25):
carry = 0
for j in range(14, -1, -1):
carry = carry * 256 + raw[j]
raw[j] = carry // 24
carry %= 24
decoded_chars.append(DIGITS[carry])
# insert hyphens
for i in range(5, 25, 6):
decoded_chars.insert(i, '-')
return ''.join(decoded_chars[::-1])
if __name__ == '__main__':
hive = Registry.Registry("SOFTWARE.hive")
key = hive.open("Microsoft\\Windows NT\\CurrentVersion")
dpid = key.value("DigitalProductId").value()
print("Windows Product Key:", decode_product_key(dpid))
-
Make it executable and run:
chmod +x get_w10_key.py
./get_w10_key.py
That will spit out your 25-character Windows key.
Bonus: Using chntpw interactively
If you already have chntpw installed you can also poke around the hive interactively:
chntpw -e SOFTWARE.hive
# now at the chntpw registry edit prompt:
cd Microsoft\Windows NT\CurrentVersion
hex DigitalProductId
# copy the blob and decode it with the above script (or by hand)
With either of these methods you’ll recover the Windows 10 license key from an unbootable partition using nothing more than a Linux live ISO. Good luck! 🚀