How to find Windows 7/8/10 product key using CMD, PowerShell, Registry

Mahesh Shrestha
Prabidhi Info
Published in
4 min readJan 16, 2020

If you are troubleshooting your PC, re-installing Windows on PC or virtual machine you will need Windows product key. The 25 long character is quite hard to memorize. You may store the key and forget about it. There are third-party apps available that can find your product key but why would do such hassle of searching and installing other apps when you can easily find your product key from the command prompt, Windows PowerShell or Windows Registry. Installation of such a third-party may cause privacy issues and you do not want that.

Windows Command Prompt

Command Prompt is a powerful command-line interpreter application used for executing different commands. It is officially called Windows Command Processor. The command lines you type are not case sensitive. Using CMD, you can do most of the action you do using GUI.

Windows PowerShell

Windows PowerShell is a Windows command line designed especially for system administrators. This includes an interactive prompt and scripting environment. With PowerShell, you can access the file system, other data stores (Registry, Digital Signature), etc.

Windows Registry

According to Microsoft Computer Dictionary, Windows Registry is ‘a central hierarchical database used to store information that is necessary to configure the system for one or more users, applications and hardware devices’ Registry include data that Windows requires for an operation like user profile, applications installed on the computer, etc.

How to find Windows 7/8/10 product key using CMD, PowerShell, or Windows Registry?

Method 1: Windows 7/8/10 Product Key Using Command Prompt

  • Run Windows command prompt (cmd) as administrator.
    You can access the Windows command prompt in numerous ways. For more information, please read:10 Cool Ways to Open Command Prompt in Windows!
  • Type the following command and press Enter.

wmic path softwarelicensingservice get OA3xOriginalProductKey

Method 2: Windows 7/8/10 Product Key Using PowerShell

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

Method 3: Windows 7/8/10 Product Key Using Registry

productkey.vbs

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

Double click on the file and it will display the product key as shown below.

You can choose any of the methods mentioned above on Windows 7/8/10. If you have any confusion/ querries regarding ‘How to find Windows Product Key’ please comment down. We will try our best to help you.

Originally published at https://prabidhi.info on January 16, 2020.

--

--