Recover Microsoft Windows Product Key (Any Version of Windows)

Hello everyone,Welcome to TechnoSpace.In this post, I am writing about retrieving Microsoft Windows product key from an existing installation of Windows.


Have you ever lost your Microsoft Windows product key at a time when you need to re-install Windows ?

If yes, then you know  how difficult it is to get the key if you lost it, but if you have a Windows installation elsewhere using the same key , you can retrieve the key from that computer but the problem is that Windows does not provide any direct option to view/copy the product key.


The key is present inside the “Registry” but again , it is not stored in the original format,probably to avoid key theft by malware/virus or for privacy or whatever reason.In the following steps, we will be making a small VisualBasic script (Don’t worry,its just copy-paste,no high-tech stuff) which will extract key from the ‘Registry’ , convert it to its original format and then display a small pop-up like window with the key written in original form, Seems cool huh !

Also one important feature of this script is that it can be made to run any number of times, on any installation of Microsoft Windows on any computer and it will return you the Product-Key.

Here is the link to script file, or you can make it yourself with the steps below. Link

Follow these steps to retrieve your Microsoft Windows product key :

  • First of all, open Notepad.You can press Win key + R to open ‘Run’ window, type in Notepad and press enter to do this.


  • Now copy paste the following code in your 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



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

  • Now go to File -> Save As, this will open a Save As dialog box.Here, change the “Save as type” to “All Files” and give any name to the file with the extension .vbs(For eg. Mykey.vbs).You can download pre-made file here


  • Save this file at any location and just double clicking the file will run it and show you a small box with the product key.


  • This small script will always help you in any computer running Windows as stated already.So you can carry it with you for a little show-off

0_pkey5_result(product key hidden to avoid piracy)

Hope this tutorial helped you out of your struggle to retrieve the product key.If you have problems still, just post a comment below and I will assist you .

Have a nice day !

Liked This Post ?

Think how much you can learn with more such posts..Get updated in your inbox right away.

Thank you for subscribing.

Something went wrong.

Warning: A non-numeric value encountered in /home/technosp/public_html/wp-content/themes/Newspaper/includes/wp_booster/td_block.php on line 353