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

Sep 9, 2018 - 26 Comments

How to get a Windows product key

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!

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Tips & Tricks, Troubleshooting

26 Comments

» Comments RSS Feed

  1. wariooo says:

    Hey that’s handy. You learn something new every day!

    I had no idea you could get the product key right out of Windows, like most people I used to have a drawer full of product licenses, registration numbers, product keys, license keys, serial numbers. This sure would have been useful back in my days of being a heavy Windows 98, NT, 2000, and XP user! But if it works in Windows 10, Window 7, then I am not sure it would work in Windows XP, despite XP still being widely used.

    I would be interested in finding the same product key information from the Mac side on Boot Camp Windows, is that possible?

    • Louie says:

      I doubt it will work on windows XP. It doesn’t work on windows vista, which is later. At least not on the home edition.

  2. D M says:

    Doesn’t work. I tried it on Win 10 on Parallels VM and all get back was a repeat of part after the “GET”

    • Owen says:

      Folks if it is not working for you then it is because you are not running CMD as administrator.

      You can’t open right into CMD, right click and run as administrator, then issue the command.

      It will report your product key.

      • Louie says:

        Nope. At least not on Windows Vista Home Edition 64-bit. I tried right-clicking and choosing to run as administrator and I still get the same error as before.

  3. D M says:

    Doesn’t work. I tried it on Win 10 on Parallels VM and all get back was a repeat of part after the “GET”

    • Bryan says:

      I got nothing back when trying first option. With second option after a delay I had a mass of red typing on screen which meant nothing to me. However it was worth a try in case ever needed – thankfully, not needed yet?

  4. Peter says:

    Does not work for me.

    I tried both of the windows commands on two different windows machines. No error, but no results.

    I tried the linux command on two dual-boot machines, but there was no MSDM in /sys/firmware/acpi/tables

  5. Venkat Kumar says:

    It worked for me on Windows 10 pro. But I need to know how to change Product key locked in BIOS

    • Eloong says:

      Confirmed works in Windows 10, shows the product key.

      As per Venkat question re BIOS, I am not sure how you can change the product key if it is tied to OEM hardware, is it not linked? I believe activation would fail if components changed?

  6. Vic McCartin says:

    Hi, Started with orig. Win8 and updated/graded via invite. Neither approach gives a return. Screen just returns to original prompt.
    Regards

  7. Zinc Whiskers says:

    CMD and Powershell both returned nothing for me.

    Apparently, if you did the free upgrade from 8.1 you might not have a key at all. Linked to your machine and MS account in the cloud?

    The VB Script I found here did work though.

    https://www.thewindowsclub.com/find-windows-10-product-key-using-vb-script

    • Kent A says:

      Confirmed. Tips in this article produced nothing. The VB Script worked like a charm.

    • ra-mo says:

      wmic must be run as admin command.com or it will not work. right-click on command prompt and run as administrator

      wmic path softwarelicensingservice get OA3xOriginalProductKey

      It works. Do it as directed. right-click command prompt, run as administrator.

      The VBScript works for me as does powershell and wmic command. Windows 10.

      VBScript from Microsoft is:

      Set WshShell = CreateObject("WScript.Shell")
      MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))

      Function ConvertToKey(Key)
      Const KeyOffset = 52
      i = 28
      Chars = "BCDFGHJKMPQRTVWXY2346789"
      Do
      Cur = 0
      x = 14
      Do
      Cur = Cur * 256
      Cur = Key(x + KeyOffset) + Cur
      Key(x + KeyOffset) = (Cur \ 24) And 255
      Cur = Cur Mod 24
      x = x -1
      Loop While x >= 0
      i = i -1
      KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
      If (((29 - i) Mod 6) = 0) And (i -1) Then
      i = i -1
      KeyOutput = "-" & KeyOutput
      End If
      Loop While i >= 0
      ConvertToKey = KeyOutput
      End Function

      from https://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_repair/how-to-find-all-windows-version-serial-key/a6d7e4eb-2adf-4e57-8ead-0bd85ec2758d

      wmic path softwarelicensingservice get OA3xOriginalProductKey

      • Louie says:

        Still not working on windows Vista home edition. Not even after I right-click to choose ‘run as administrator’ before I open the command window.

  8. Wim F. says:

    Doesn’t work here either. I tried it on Win 10 on Parallels VM; result is just another command prompt.

  9. Rahul says:

    Doesn’t work on Windows 10 :)

  10. Dun says:

    I get the blue screen of death. :)

  11. walking dad says:

    Doesn’t work to me, either.

  12. Remyj says:

    Or you can install the free utility Belarc Advisor which gives you product keys for Windows, Office, and all other licensed packages as well as all your hardware specifics, model, and serial numbers.

    The info from there can be copied and pasted to any document format or can be printed to paper or .PDF file.

  13. Wim F. Abbenhuis says:

    Does not work here either. Win 10 and Parallels. All I get is a new command prompt (Yes, I was in admin-mode).

  14. Bryan says:

    Tried both ways and failed. First option – nothing. Second option a delay then a mass of red info that I did not understand.

    iMac i5 5k 2016 with 16GB memory, High Sierra with Windows 10 pro. All fully up to date.

    Thanks for trying, but failed.

    • Elong Masky says:

      Are you trying in Windows Boot Camp or in Vmware?

      I can confirm it works on native Windows PC.

      It should work on Mac the exact same, there is no difference in Mac with Boot Camp and PC. A Mac is just a PC now with soldered components, running Mac OS, whereas PC is running Windows. This is why Hackintosh is prolific, and so easy now.

      Fascinating reports here keep them up ya’ll.

      • Louie says:

        I tried on boot camp running windows 7 ultimate. Didn’t work. Got the same error I had earlier seen in windows vista home edition on a native windows pc.

  15. Eeyoure says:

    Neither of these work for me with Windoze 10 running under Parallels Access. The command prompt returns with a blank.

  16. vdiv says:

    Some system info apps fetch the product key. Piriform’s Speccy for example shows it under the Operating System section as the Serial Number.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac