Sunday, August 28, 2016

VB Script to Know Windows XP Product Key

If you ever loose your Windows XP Product Key (CD Key or Serial Key), you can find it through registry. But the value will be encoded, so following code will find the key in registry and decodes it and shows it in a message box. This way you can get back your Serial Key.

Create a Notepad file with title "ProductKey.vbs" and write the following code into it and save the file. If you double click the file, it will show the product key.

******************************************************
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKEY_LOCAL_MACHINE\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
****************************************************

1 comment:

Anonymous said...

Also available in the 386 directory, even for programs on CD. open (don't run) CD, open 386 directory. search with *.txt, look for either two files "Product.ini or unattached.txt. the product key is at the bottom of the page, ALSO, search for "Pid" and several product ID's will show.