How to Find Windows Product Key via Command in Windows or Linux

Have you ever needed to find a Windows product key? Maybe you’re troubleshooting a Windows PC, planning on re-installing Windows 10 in a virtual machine, installing on a PC, or installing into Boot Camp on a Mac, or maybe you have a PC computer running Windows that needs the Windows product key for some reason or another.

This article will show you three different ways for how to find a Windows product key directly from Windows itself on the computer, without having to rely on tracking down the Windows product key card from a box, email, or COA. So if you lost or misplaced any of those, don’t worry, the methods covered will work to retrieve the Windows product key directly from Windows 10, Windows 8, Windows 7, or even Linux. And yes if you’re running Windows in Boot Camp on a Mac or in a VM, these tricks work there too.


This article is obviously aimed at users who need their Windows product key for whatever reason. Nonetheless, it’s worth remembering that you can download the Windows 10 ISO directly from Microsoft for free, and you can then use that ISO to create a Windows 10 installer drive for Boot Camp, install Windows 10 into VirtualBox (also free), into Parallels or VMWare, or even for installing on PC hardware. And no, you do not need to activate in order to install Windows 10 from the ISO, nor do you need a product key, but of course there are some limitations with running Windows without activation, of which you can always activate later if needed. Anyway, assuming you have an authorized version of Windows running somewhere and you need the product key, read on to discover three ways to retrieve it.

How to Get the Windows Product Key via cmd in Windows

The simplest way to find the Windows Product Key license is to turn to a privileged command prompt in Windows and execute a command that retrieves the software license product key.

From Windows, open a new Administrator Command Prompt window and then enter the following syntax:

wmic path softwarelicensingservice get OA3xOriginalProductKey

Hit Enter / Return for the Windows product key to be displayed, it is a 25 character alphanumeric string in the format of the following:

XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

That’s it. You can get the Windows product key on nearly any Windows installation using this method.

How to Find Windows Product License Key via Powershell

You can also retrieve a Windows product key from Windows Power Shell with the following command string, entered into a privileged command prompt:

powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"

Regardless of which method you use, the product key will be the same (assuming it’s being run on the same installation of Windows anyway).

How to Get Windows Product Key via Linux

You can also get the Windows Product Key from Linux by entering the following privileged command:

sudo cat /sys/firmware/acpi/tables/MSDM | tail -c 32 | xargs -0 echo

Executed correctly with the proper syntax and you’ll find your Windows product key immediately reported back.

This handy linux trick was found on Twitter by @brandonprry and is perfect for users who dual boot Windows and Linux on a computer. And no, in case you were wondering, the linux specific trick does not seem to work from a Mac running Windows in Boot Camp, but if you do know of a method to retrieve a Windows product key used in Boot Camp from Mac OS, share it with us in the comments below.

You can use any of the three methods outlined above to find the Windows product key, obviously two are specific to Windows while the third applies to Linux. There are other options available as well, including using Windows specific utilities like ProduKey which can reveal a Windows product key as well as a Microsoft Office product key, which is quite helpful if you’ve misplaced those as well.

Where can I find the Windows product key usually?

Aside from using the above methods to find a Windows Product Key, the typical places you’d find the 25 digit license key code are; on the COA sticker, in the physical software box, or in an email if you bought Windows digitally.

As you may already know, the most typical place for the Windows product key to be found is on the shiny COA (Certificate of Authenticity) sticker adhered to the enclosure of a Windows PC, whether it’s a laptop or desktop, but maybe that sticker was lost, peeled off, damaged, or never included at all.

If you bought a physical copy of Windows, the product key is typically included in the box itself on a piece of paper, but of course that can be lost or misplaced.

And if you bought Windows digitally, you typically get the product key in an email instead.

But if you’re running Windows in a virtual machine, or on a Mac in Boot Camp, or on a home-built PC or even some laptops, the Certificate of Authenticity sticker for Windows that includes the product key will not be available, and perhaps you long ago lost the email or box containing the product key itself. Or maybe you’re on the road and just don’t have the materials with you, or access to the email or other methods of obtaining the license key. This happens fairly often, regardless of how, where, and why you’re using Windows, which is why it can be so helpful to retrieve the product key directly from software.

Obviously if you don’t use Windows then this will be of no use to you, but Windows remains the most common operating system in corporate, government, and educational environments, and that’s unlikely to change anytime soon. So even if you’re a heavy Mac user or Linux user, you may still be working with Windows from time-to-time, and this can apply to you as well.

If you know of any other tips, tricks, or methods to obtain the Windows product key license number from Windows, Linux, or Mac OS, share them with us in the comments below!

Source: OSX Daily