Skip to main content
Topic: Get Windows product key (Read 3576 times) previous topic - next topic

Get Windows product key

https://fossbytes.com/how-to-find-windows-product-key-lost-cmd-powershell-registry/

Method 1
So, just copy and paste the following script in a Notepad window and save its as productkey.vbs by choosing the “All Files” option in “Save as type.”

Code: [Select]
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

After saving this file, just click on it and a new popup window will show your Windows product key in the registry. You can copy or note this down somewhere to use it later.

Method 2

Code: [Select]
CMD:> wmic path softwarelicensingservice get OA3xOriginalProductKey

Method 3
Paste the following in an administrative powershell prompt
Code: [Select]
powershell “(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey”