Find/Check Your Windows 10 Product Key Using Script or Command-line

Advertisements

In this tutorial, we will show you how to find or check your Windows 10 Product Key Using Script or Command-line. Windows 10 now comes with a digital license key that is bind to your account. As a result, this negates the use of the manual entering of the product key. All you have to do is simply login with the account bind to that product key and your setup will automatically be activated. However, there are still quite a few reasons as to why one would need to find their laptop or PC’s key.

To begin with, if you need to reinstall the Windows on your PC, then this key might be required, especially if you are installing an older build of Windows. Along the same lines, if you plan on selling your PC, then also some sellers might ask for the product key just to make sure that the installed Windows is a genuine one. So with that in mind, if you ever come across the need to find your Windows 10 product key, then this guide will come in handy. Follow along for the complete instructions set.

product key windows 10

Find Your Windows 10 Product Using Script or Command-line

As evident from the heading, we would be using two different approaches to carry out the aforementioned task. The first one will be done via the Command Prompt or Power Shell window. On the other hand, the second method calls for a Visual Basic Script and requires a lot more effort than the former.

Advertisements

So for a quick guide, we would recommend going for the Command Prompt window. But if you wish to dive deep into the technical jargon, the second method is always available for you. Let’s check out both these methods to find out the Windows 10 product key.

Method 1: Using CMD Window/PowerShell

  1. Head over to the Start menu and search for CMD.
  2. Launch the Command Prompt Window as an Admin.
  3. Then simply copy-paste the below command in that CMD window:
    wmic path softwarelicensingservice get OA3xOriginalProductKey

    cmd window product key

  4. If you wish to carry out the aforementioned task in the PowerShell window, then search for the same from the Start menu and launch it as an admin as well.
  5. Then copy-paste the following command (if Ctrl+V shortcut doesn’t work, then simply right-click inside the window)
    (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey

    powershell product key

  6. That’s it. These were the steps to find your Windows 10 Product using Command-line or the PowerShell window. Let’snow check out how the same could be achieved via the Script.

Method 2: Find Windows 10 Product Key Via Script

Not only does this method requires a lot of effort, but some users have reported getting an incorrect product key as well. So we would recommend you to go ahead with the first method itself for all purposes. In our testing as well, the CMD and PowerShell window gave the same result (the correct key), wheres the scrip method gave an altogether different key. So just for the sake of learning and gaining some extra information, you could check out the below steps:

  1. First off, you will have to create a new Notepad file. For our convenience, we would be doing so on the Desktop itself
  2. So right-click on your desktop and select New > Text Document.
    new text document
  3. Then copy-paste the below command into the Notepad file:
    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
  4. Now head over to File and click on Save as. You might give this file any name of your choice but the extension should be .vbs only. For this guide, let’s name it pk (short form of ‘product key’). So under the File Name, enter pk.vbs and under the File Type section, change it All Files, and hit Save.
    save vb script
  5. Once the file has been saved, double-click to launch it and you should the product key will be right in front of you.
    script product key

So with that, we conclude the guide on how to find the Windows 10 product key. We have shared two different methods for the same- using the Command prompt/PowerShell window or via the VBS Script. While we would recommend going with the former method any day of the week, the ultimate decision lies in your hands. On that note, do let us know which method you end up selecting. Rounding off, here are some iPhone Tips and TricksPC tips and tricks, and Android Tips and Trick that you should check out as well.

Modified on August 28, 2020

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.