How to Recover Windows 10 Product Key Using Linux
One day I was wondering, “How come Windows does not ask you for a product key when you do a clean install of Win after wiping every thing from the hard drive?”. I then did a little research and found out that starting with Windows 8 and Windows 10, the Windows product key was being stored in the motherboard of the device instead of being physically written on the laptop.
In Linux, you can easily retrieve the Windows License Key with a simple console command. I will also show you how you can find your Windows Product Key from your Windows partition (Using Linux) in case it is not an OEM key (like in laptops) but a retail key that you have purchased and manually typed in. Let’s get started.
Root access is required in order to retrieve your product key. Make sure that you have sudo privileges or you are using the root account.
First step is to open the terminal. Most of the Linux distributions these days come with one. On Ubuntu there would be gnome-terminal, on xfce xfce-terminal is available, on kde there is konsole and so on.
In the terminal, type:
sudo cat /sys/firmware/acpi/tables/MSDM
The output will be similar to this:
MSDMU _ASUS_Notebook ASUSXXXXX-XXXXX-XXXXX-XXXXX
Here I have replaced the actual product key for
There you go, you now have your product key for Windows that came pre-installed with your laptop or notebook.
But what if you want to recover a key for your Desktop, the one that you have purchased and not the OEM one that came with your laptop?
If your Windows installation is broken and you cannot log back into it, there is a program for Linux to read registry entries from a Windows boot drive.
chntpw is a utility that can be used to edit Windows registry from a Linux based operating system.
Ubuntu & Debian based distributions:
sudo apt install chntpw
sudo dnf install chntpw
Arch Linux based distributions:
sudo pacman -S chntpw
After the installation is complete,we need to do is mount the drive where Windows is located.
Run this command to identify the location of your windows drive:
lsblk -o NAME,FSTYPE,LABEL,UUID,SIZE,TYPE
This command should display all the drives and partitions connected to your system, their names, file system types, label, UUID, size, and type. A Windows partition should have an ntfs file system, you can also guess your drive by its size or label.
Once we have identified the drive, it needs to be mounted.
sudo mount /dev/sda7 /mnt
Change /dev/sda7 to the location where your Windows drive is.
Installing chntpw & mounting the drive is easy but the real problem is finding the correct place to look for the key. The key for your windows install may be located in a different place in the registry depending on the version and build of windows that you are using.
In my case, it was in
So to access this location from chntpw, in a console/terminal, type:
chntpw -e /mnt/Windows/System32/config/RegBack/SOFTWARE
And after entering the above command, type in:
dpi \Microsoft\Windows NT\CurrentVersion\DigitalProductId
Your Windows product key should be on your screen.
Well, this is it for this tutorial, I hope you were able to successfully retrieve your Windows key.
If you are having trouble activating your Windows key, chances are that it is an OEM one. So in conclusion it will refuse to work with a device other than the one it originally came with, most likely a laptop/notebook. In cases like these you can try to contact Microsoft support and see if they can help you
If you have any questions, suggestions, or feedback, regarding this tutorial, do leave a comment down below.