Retrieve your Windows Product Key without extra software

Neemobeer

Windows Forum Team
Staff member
#1
This quick tutorial shows you how to retrieve your Windows product key from a working system. This is helpful in cases where your device doesn't have a sticker.

  • Open powershell (Press the Windows Key, then type powershell)
  • Type the following command
pskey.png


The output will be your 25 character Windows product key in the form XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

This should work on Windows 7, 8, 8.1 and 10
 


strollin

Senior Member
#2
Copy & paste below so you don't need to type the command:

Code:
$(Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey
 


Neemobeer

Windows Forum Team
Staff member
#3
I suppose that would have been helpful, thanks @strollin
 


bochane

Honorable Member
#4
Hm, I just see nothing...:(
I must be doing something wrong :confused:
 


strollin

Senior Member
#5
Are you pasting the command above into the PowerShell prompt? (Won't work from a normal command prompt)
 


Neemobeer

Windows Forum Team
Staff member
#6
bochane try just tying Get-WmiObject -query 'select * from SoftwareLicensingService' and look for the OAx3OriginalProductKey property.
 


bochane

Honorable Member
#7
bochane try just tying Get-WmiObject -query 'select * from SoftwareLicensingService' and look for the OAx3OriginalProductKey property.
Did that, but OAx3OriginalProductKey is empty

I started this PC with Windows 7, bought an SSD and an update to W8 and installed it multibootable. The last step was switching from W8.1 to W10.
Nevertheless I expected a licence.

Added:
Same result on my laptop, an empty OAx3OriginalProductKey property. And again it started with XP, got a free upgrate from Acer to W7 and is now running W10

Thanks for looking into it.
 


Last edited:

cursedboy

Senior Member
#8
This trick work better for me
1. Open Notepad.
2. Copy and paste the following text into the Notepad window

Code:
Option Explicit

Dim objshell,path,DigitalID, Result
Set objshell = CreateObject("WScript.Shell")
'Set registry key path
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Registry key value
DigitalID = objshell.RegRead(Path & "DigitalProductId")
Dim ProductName,ProductID,ProductKey,ProductData
'Get ProductName, ProductID, ProductKey
ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName")
ProductID = "Product ID: " & objshell.RegRead(Path & "ProductID")
ProductKey = "Installed Key: " & ConvertToKey(DigitalID)
ProductData = ProductName  & vbNewLine & ProductID  & vbNewLine & ProductKey
'Show messbox if save to a file
If vbYes = MsgBox(ProductData  & vblf & vblf & "Save to a file?", vbYesNo + vbQuestion, "BackUp Windows Key Information") then
   Save ProductData
End If



'Convert binary to chars
Function ConvertToKey(Key)
    Const KeyOffset = 52
    Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert
    'Check if OS is Windows 8
    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
    keypart1 = Mid(KeyOutput, 2, Last)
    insert = "N"
    KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
    If Last = 0 Then KeyOutput = insert & KeyOutput
    ConvertToKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5) & "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & Mid(KeyOutput, 21, 5)
   
   
End Function
'Save data to a file
Function Save(Data)
    Dim fso, fName, txt,objshell,UserName
    Set objshell = CreateObject("wscript.shell")
    'Get current user name
    UserName = objshell.ExpandEnvironmentStrings("%UserName%")
    'Create a text file on desktop
    fName = "C:\Users\" & UserName & "\Desktop\WindowsKeyInfo.txt"
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set txt = fso.CreateTextFile(fName)
    txt.Writeline Data
    txt.Close
End Function
3. Save the text above to a file with the ".vbs" extension on the Desktop.

Bonus tip: To make sure that you saving the file correctly with the ".vbs" extension, you can type its name enclosed in double quotes, for example, "BackupWindowsKey.vbs".

4. Now open your BackupWindowsKey.vbs file

I hope this work for you.

 


RichM

Well-Known Member
#9
Seems like a lot of work to me when Belarc will show the key as will "Show Key" though I realize the other 3rd party ones no longer work after Windows 8.
Showkey - Windows 10 Forums
 


Sonny

Excellent Member
#10
Speccy will also show the key in Windows 10.
 


#11
It works great on Windows 8.1.
 


catilley1092

Extraordinary Member
#12
Doesn't work on my Windows 10 Pro install.:(

Tried both the regular way & as Administrator, to no avail. Maybe because it's a self-build.:)

Cat
 


Neemobeer

Windows Forum Team
Staff member
#13
It may be because of the upgrade. You can try the old vb script way as well. Download the vbs file here and just double click it or from a cmmand prompt type cscript.exe <scriptname>
VBS Script to get the Windows(R) 7 Product Key from a PC's registry. · GitHub
 


catilley1092

Extraordinary Member
#14
Neemobeer, that did the trick!:D

Same as shown with Speccy. Mine was an upgrade from Windows 8.1 to 10.

Thanks for the added information!:)

Cat
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.
Top