Extract Product Keys from Windows Registry

Previous topic - Next topic
QuoteFor Windows 10/11, standard Registry keys are often encrypted or generic placeholders.

Fastest Method: Open PowerShell as Admin and type:
`wmic path softwarelicensingservice get OA3xOriginalProductKey`
This pulls the original key embedded in your motherboard (BIOS) instantly. For other software, you must use a VBScript to decode the `DigitalProductId` binary value.

Microsoft hides product keys to prevent piracy. In the Windows Registry, the key is not stored as plain text (like "AAAA-BBBB..."); it is stored as binary data (Hex) under the entry `DigitalProductId`. Furthermore, if your Windows was activated via a "Digital License" (common in 2025-26), the Registry key is often just a generic "dummy" key that serves no purpose for re-activation.

Checklist

  • Administrator Access to the PC.
  • Notepad (to create the decoding script).
  • The Hidden Requirement: Knowledge of whether your Windows is Retail or OEM. If it's OEM (came with the laptop), the key is in the BIOS, not the Registry. If it's Retail (you bought a box/email), it's in the Registry/Email.

Step-by-Step Guide

  • Step 1: The "BIOS Key" Method (For Laptops/Pre-built PCs)
    If you are looking for the Windows key that came with your Dell/HP/Lenovo:
    Open Command Prompt (Admin) or PowerShell.
    Paste this command:
    wmic path softwarelicensingservice get OA3xOriginalProductKeyIf a 25-character key appears, that is your hard-coded license. Write it down.
  • Step 2: The "Registry Script" Method (For Retail/Older Software)
    Since the Registry key is encrypted, you cannot just "read" it. You must "decode" it.

    1. Open Notepad.
    2. Copy and paste the code block below perfectly.
    3. Save the file as RecoverKey.vbs (Select "All Files" in "Save as type").
    4. Double-click the file. It will popup your Windows Product Key.

    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
  • Step 3: Checking for Office Keys (2016/2019/2021)
    The Registry no longer stores the full Office key. It only keeps the last 5 characters.
    Open Command Prompt (Admin).
    Navigate to the Office folder (e.g., `cd "C:\Program Files\Microsoft Office\Office16"`).
    Run: `cscript ospp.vbs /dstatus`
    Look for "Last 5 characters of installed product key".
    Use these 5 characters to match against your physical cards or email receipts to find the correct full key.

How It Works & Hidden Details

The "DigitalProductId" Logic:
Windows stores the key in `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion`.
The value `DigitalProductId` is a binary array. The product key starts at Offset 52. The VBScript above reads this binary data, performs a base-24 conversion, and maps it to the character set "BCDFGHJKMPQRTVWXY2346789" (Microsoft avoids letters like I, O, Z, 1, 0 to prevent confusion).

The "BackupProductKeyDefault":
In some newer Windows 10/11 builds, you might find a value named `BackupProductKeyDefault` in `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform`.
This might show a plain text key. However, be warned: this is often the "Generic Key" used for installation, not your actual activation license.

Things to Watch Out For

  • Risk 1: The "Generic Key" Trap.
    If your extracted key ends in 3V66T (Pro) or 8HVX7 (Home), do not rely on it. These are generic keys used by millions of PCs that upgraded via Digital License. They will not activate a fresh installation.
  • Risk 2: Third-Party Malware.
    Many websites offer "Key Finder" tools that are actually Trojans. If you must use a tool, stick to ShowKeyPlus (available on Microsoft Store) or NirSoft ProduKey (often flagged as false positive by antivirus, but generally safe). The VBScript method above is safer as it uses no external software.

If your PC came with Windows 10/11, you likely don't need the key at all. Just skip the key entry during install; it will auto-activate when you connect to Wi-Fi.

Update: Critical Changes for Windows 11 24H2 (2026)

  • WMIC Command Removed:
    The command `wmic path softwarelicensingservice...` will now fail on most up-to-date Windows 11 systems (Version 24H2 and later). Microsoft has disabled WMIC by default.
    New Method: You must use the modern PowerShell command.
    (Get-CimInstance -query 'select * from SoftwareLicensingService').OA3xOriginalProductKeyPaste this into a standard PowerShell window (not CMD) to see your BIOS key.
  • Office 2024 & Microsoft 365 Keys:
    For the new Office 2024 and Microsoft 365 (Subscription), the `ospp.vbs` method often returns "No installed product keys detected" or a generic placeholder. This is because modern licenses are token-based and tied to your Microsoft Account, not the local registry.
    Solution: You cannot recover these keys from the PC. You must log in to https://account.microsoft.com/services to manage your license.
  • ShowKeyPlus (Safe Alternative):
    Since VBScript is now a "Feature on Demand" and may be disabled on secure PCs, the script above might fail to run.
    Recommendation: Download ShowKeyPlus directly from the Microsoft Store. It is open-source, safe, and can distinguish between your "Installed Key" (Generic) and "OEM Key" (BIOS) instantly without running scripts.

Verified: The VBScript logic provided still works on older Windows 10 builds, but the PowerShell command is required for Windows 11 24H2+.

Similar topics (3)