Finding your Windows Product Key


You may need to reinstall Windows at some point for a variety of reasons, but what if you can’t find your Windows product key?! It’s totally OK to borrow a friends windows disc if you don’t have your own, given that you use your valid product key for one active installation, and the disc is the same version of windows you are licensed to use.

Sometimes the product may rub off or fade from the sticker on the computer case or your Windows disc or you might have just misplaced the installation media. If you bought a refurbished or used computer you might not have the product key readily available. Whatever the case, not to worry! The product key is stored in the registry in binary format, and I’m going to show you how to find and recover your product key in just a few minutes  by using notepad and creating a simple script. This should work on most any recent version of Microsoft Windows. I have tested it on XP, Vista, Windows 7, Windows 8/8.1 and this demo is done on a Windows 10 machine. Just follow the simple steps below.

 

With your computer on, create a new text document on your desktop in Notepad by right clicking on the desktop and selecting “New > Text Document

step1

 

Open the new document and copy and paste the code below:

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

In Notepad, select File > Save As

 

This step is important! Name your file windowskey.vbs and in the drop down box below you need to change “Save as Type” to “All Files”.

step2

 

You should now have a file on your desktop that looks like the image below.

step3

 

Double click the file and your windows key will pop up! You can press Ctrl + C to copy and paste the key into another file to save it, or just write it down. That’s all there is to it. Now you can do a clean install with your valid product key.

step4