How to find your Windows product key

If you’re planning on doing a re-installation of Windows, it’s a good idea to make a backup of your product key. If the Certificate of Authenticity has become unreadable due to wear and tear and you don’t have a note of it anywhere else then this simple script will tell you what your product key is.

Copy the following script into notepad:

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

Save this as productkey.vbs ensuring that you change the “Save as type” to “All Files”.

Then run this script by double clicking it, a popup window will reveal your product key.