HowTo Windows

How to find Windows 11 Product Key using Command Prompt

A Microsoft Product key is needed to activate the version of the Windows running on your computer. Activation helps Microsoft to ascertain that your copy of Windows is genuine and has not been used on any other device.

Depending on how you got your copy of Windows 11 you would either need a digital license or a 25-character alphanumeric product key to activate Windows. If you have bought a standalone copy of Windows 11 from an authorized retailer, you would get a Product Key for activation.

How is a Digital License Different from a Product key?

A PC that came with preinstalled Windows 11 would probably have a digital license. If you upgraded your computer from Windows 10 then also you would have a digital license.

A digital license is present on a hardware storage that is physically embedded in the motherboard and is linked to your Microsoft Account which you provided during the initial setup of Windows on your PC.

In case of digital license, Microsoft would not ask you to enter any product key to activate Windows. It would use the Hardware backed identification / verification and automatically activate your copy of the Windows OS, whenever you connect it to the internet.

A digital license has to be linked to a Microsoft Account so that your copy of Windows can be reactivated in case of a major hardware change, such as changing of the motherboard.

However, if you used a Product Key to install Windows and didn’t link it to any Microsoft Account then you would have to keep the key safe, so that you can reinstall and re-activate Windows.

If you lost or misplaced the key then there are many ways to access it on the computer where you have Windows installed. Some of the methods are explained below.

View Product Key using Command Prompt

Press the Windows + S shortcut key and search for Command Prompt in the taskbar search.

Click on Run as administrator to run Command Prompt with elevated privileges.

Type or copy-paste the following command in the Command Prompt Window and hit Enter.

wmic path SoftwareLicensingService get OA3xOriginalProductKey

This will display the 25 character alphanumeric key within the Command Prompt window.

Use PowerShell to view Windows Product Key

Press the Windows + X shortcut key and select Windows Terminal(Admin).

In the Terminal Window, type or copy-paste the following command and press Enter.

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

This will display the Product Key of the Windows OS installed and running on your PC.

Get Windows 11 Product Key using VBScript.

VBScript is a scripting language developed by Microsoft for creating web based applications and automating Windows tasks. You can write a simple VBScript to read the Product key of your Windows installation. 

It can be written and saved using the Notepad. We have given the code below, copy-paste the following VBScript code in a notepad window.

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

Press Ctrl + S, shortcut key to open the Save dialog. Enter ProductKey.vbs in the Filename field. In the Save as type drop-down select All files (*.*). Then, Save the file.

Double click the ProductKey.vbs file to run the script. It would open a Message box with the product key.

Use Third Party Apps to find the Product Key

You can also install third party apps to look for the product key. However, There are very few apps in the Microsoft Store for finding Product keys. One such app available in Microsoft Store is ShowKeyPlus.

You can also download from its Gituhub page. The app would show the details as shown in the following screenshot, along with the installed Product key.

You can also use this app to reverse search a Product key to find the version of Windows associated with that key.

If all else fails, you can try contacting the Microsoft Support or the authorized retailer who sold you the Windows License. They maintain a record of the customers and the Product Keys sold by them. They would probably be able to help you to find they key.