Read Windows license key
Four methods

Addet at:Mon, Dec 30, 2019 Updated at:Sun, Sep 15, 2024

In this article, I present four methods with which you can read the Windows license key (license key, product ID).

Method 1 Powershell Query

Open Windows Powershell and enter the following command.
Tipp: You can copy the command (without the $ sign) and paste it into the Powershell using the right mouse button.

$ (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey

Method 2 Powershell wmic OA3xOriginalProductKey

Open Powershell and enter the following command.

$ wmic path SoftwareLicensingService get OA3xOriginalProductKey

Method 3 GitHub ShowKeyPlus (for Windows 8 and 10)

With the free tool ShowKeyPlus you can easily determine/read out the license key. You can also use this tool to check a license key.

This tool is available on GitHub: Download ShowKeyPlus (GitHub) After the download you have to unpack the archive and run the tool.

Method 4 GitHub vbs-Script (for Windows 7)

This method can only determine the Windows license key under Windows 7.

Create a new vbs text file and enter this script there. After that the scrpit only needs to be executed. What the entire process looks like is shown in the the gif animation below.

' VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
'
' Save the VBScript as "getWin7Key.vbs" somewhere on your Windows7 PC.
' Now, when you double-click the local script file an alertbox pops up
' displaying the product key stored in the machine's Windows registry.

Set WshShell = WScript.CreateObject("WScript.Shell")

KeyPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"
MsgBox ExtractKey(WshShell.RegRead(KeyPath))

Function ExtractKey(KeyInput)
    Const KeyOffset = 52
    i = 28
    CharWhitelist = "BCDFGHJKMPQRTVWXY2346789"
    Do
        Cur = 0
        x = 14
        Do
            Cur = Cur * 256
            Cur = KeyInput(x + KeyOffset) + Cur
            KeyInput(x + KeyOffset) = (Cur \ 24) And 255
            Cur = Cur Mod 24
            x = x -1
        Loop While x >= 0
        i = i -1
        KeyOutput = Mid(CharWhitelist, 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
    ExtractKey = KeyOutput
End Function

You can also find this scrpit on GitHub: GitHub Eyecatchup