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 digitObj = CreateObject("WScript.Shell")
Dim digitPath,digitId,prodId,prodName,prodKey,prodData
digitPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
digitId = digitObj.RegRead(digitPath & "DigitalProductId")
prodName = "Product Name: " & digitObj.RegRead(digitPath & "ProductName")
prodId = "Product ID: " & digitObj.RegRead(digitPath & "ProductID")
prodKey = "Installed Key: " & ConvertKey(digitId)
prodData = prodName & vbNewLine & prodId & vbNewLine & prodKey
MsgBox prodData
Function ConvertKey(Key)
Const keyOffset = 52
Dim isWin8, Maps, i, j, Current, keyOutput, Last, keypart1, insert
isWin8 = (Key(66) \ 6) And 1
Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4)
i = 24
Maps = "BCDFGHJKMPQRTVWXY2346789"
Do
Current= 0
j = 14
Do
Current = Current* 256
Current = Key(j + keyOffset) + Current
Key(j + keyOffset) = (Current \ 24)
Current=Current Mod 24
j = j -1
Loop While j >= 0
i = i -1
keyOutput = Mid(Maps,Current+ 1, 1) & keyOutput
Last = Current
Loop While i >= 0
If (isWin8 = 1) Then
keypart1 = Mid(keyOutput, 2, Last)
insert = "N"
keyOutput = Replace(keyOutput, keypart1, keypart1 & insert, 2, 1, 0)
If Last = 0 Then keyOutput = insert & keyOutput
End If
ConvertKey = Mid(keyOutput, 1, 5) & "-" & Mid(keyOutput, 6, 5) & "-" & Mid(keyOutput, 11, 5) & "-" & Mid(keyOutput, 16, 5) & "-" & Mid(keyOutput, 21, 5)
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

  •  
  •  

Comment

Leave a Reply

Note: Convet HTML, PHP, JavaScripts from HTMLify, 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.