- Oct 23, 2012
- 12,527
Creating a script to find your Windows product key
1. Copy & paste the following to Notepad
2.Name the file productkey.vbs or something else but must end with .vbs
3. Select "All Files" from the Save as type dropdown menu and save to your desktop or some where else
4. Double click the file and your product key will show up in a pop up window which can be saved and used if you need to reinstall windows
1. Copy & paste the following to Notepad
Code:
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
2.Name the file productkey.vbs or something else but must end with .vbs
3. Select "All Files" from the Save as type dropdown menu and save to your desktop or some where else
4. Double click the file and your product key will show up in a pop up window which can be saved and used if you need to reinstall windows