Find Your Windows Product Key with Simple Script

Whether you got your computer with Windows already installed on it or simply lost your product key, this post could be your life saver. There are number of methods that you can follow to retrieve your Windows Product key, however from my personal experience, I found the following method to be the easiest one. So, lets get started.

Step 1: Simply open up your Notepad application and copy the following snippet.

Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Cur = 0
x = 14
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 2: Paste the snippet on the Notepad.
Step 3: Click on “File” menu and select “Save As” option.
Step 4: From the “Save As” window, select “All Files” as your file type (screenshot).

Notepad Save As WindowNotepad Save As Window.

Step 5: Type anything as your file name with .vbs (Visual Basic Script) extension.
Step 6: Once you are done with saving the file, double click on the file and it should pop up a screen with your Windows Product Key. That’s all.

Note: I have tested this script on both Windows 7 and Windows 10 (64bit) OS and it worked without any issues.

Today In History



Leave a Reply

Note: Convet HTML, PHP, JavaScripts from Postable, before posting from comment section.
License: By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution. Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.