The Windows Product key is generally stored in the System registry in the path HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId
To view this open Registry Editor as an elevated Administrator user and navigate to HKEYLOCALMACHINE > SOFTWARE > Microsoft > Windows NT > CurrentVersion.
The DigitalProductId value contains the Product Key as binary data (REG_BINARY).
We need to decode this value to the correct hyphenated format that Windows accepts. The following vBscript code can be used to achieve just that.
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
Open Notepad and copy paste the above code in to it. Save the file as Recover Product Key.vbs. Ensure that the Save as type is changed to All Files.
Browse to the folder where you saves the file and double click on it. Your Windows Product Key will be displayed in a message box as shown below.
Pro Tip:- To copy the Product Key, click on the message box and tap Ctrl + C and paste it in Notepad!