Retrieve your Windows Product Key without extra software

Neemobeer

Windows Forum Team
Staff member
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

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

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

strollin

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

Neemobeer

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

bochane

Extraordinary Member
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
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.

 

catilley1092

Extraordinary Member
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
 

catilley1092

Extraordinary Member
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
 

kiki40

New Member
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
View attachment 31890

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
Open Notepad.
2. Copy and paste the following text into the Notepad window
 

Jean Parrot

Well-Known Member
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.
Thank you. I tried it and it was instantaneously shown. I wish that I could code like this myself.
 

TheDD

Member
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.
This is the only non third party software that worked for me so far!
 

TheDD

Member
Are you pasting the command above into the PowerShell prompt? (Won't paintings from a regular command activate)
Me? Yes I tried a powershell prompt, then I tried running the same prompt as admin. But both didn't show my key.
It seems like for some people Neemobeer's command works but for some people only cursedboy's command worked
 
Top