How to view your product key in Windows 10, Windows 8 and Windows 7

If you lost or forgot where you had stored your Windows product key, I have a solution for you. Today we will see how a simple VBS script can be used to show us the product key of an installed copy of Windows 10, Windows 8 or Windows 7. It is a simple solution to extract your product key from the OS installed on your PC without using any third party software. Here we go.


Actually, earlier I posted a similar solution which used PowerShell. but many users complained that it fails for them. PowerShell might require additional user skills and extra tweaks to run unsigned cmdlets.

Compared to PowerShell, this VBScript solution is almost perfect. All you need to do is to just click the file. To view your Windows 10 product key

  1. Open Notepad.
  2. Copy and paste the following text into the Notepad window
    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  
         
        If (isWin8 = 1) Then 
            keypart1 = Mid(KeyOutput, 2, Last) 
            insert = "N" 
            KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0) 
            If Last = 0 Then KeyOutput = insert & KeyOutput 
        End If     
         
     
        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".
    backup windows product key Windows 10
  4. Now open your BackupWindowsKey.vbs file
  5. Voila, you product key is displayed on the screen!
    show Windows 10 product key

Click here to download the BackupWindowsKey.vbs file

I tested this trick on Windows 7, Windows 8 and Windows 10. It works flawlessly in all mentioned operating systems. Credits: nononsence @ MDL.

88 thoughts on “How to view your product key in Windows 10, Windows 8 and Windows 7

  1. Dave Johnson

    Awesome!

    Well-loved. Like or Dislike: Thumb up 82 Thumb down 7

    Reply
    1. Sergey Tkachenko Post author

      Yep, very nice trick

      Well-loved. Like or Dislike: Thumb up 30 Thumb down 6

      Reply
    2. Franco

      Thanks man, great Sergio

      Well-loved. Like or Dislike: Thumb up 12 Thumb down 4

      Reply
    3. Brannon K

      I’m in charge of license management at the small IT company I work for. I cannot tell you what a gem you have just provided now that Windows 10 reinstalls are starting to happen thanks to some users. No longer have to worry about productkey64 or anything else. Very nice work, today you win the internet!

      Well-loved. Like or Dislike: Thumb up 11 Thumb down 2

      Reply
    4. Bill

      Awesome!

      Like or Dislike: Thumb up 4 Thumb down 1

      Reply
    5. Ivan

      hey bro can u provide me a method to change the product ID because my product key and product id is changed due to installation of a third party soft ware but i manage to find my old product ID and Key how can i change the current (interrupt/change by third party software) to my original product key and ID (legal product ID and Key when i purchase my PC comes together)

      Like or Dislike: Thumb up 2 Thumb down 1

      Reply
    6. Milind SHroff

      Worked wonders…!! Thanks a lot.

      Like or Dislike: Thumb up 3 Thumb down 0

      Reply
  2. Willy

    hi, i have try it, but it display’s me just NNNN’s, i have try the script and the download, well i really like your job, and i think my computer is a special case xD. THANKS!!!

    Like or Dislike: Thumb up 2 Thumb down 1

    Reply
  3. ken

    Doesn’t work for me. Win 8.1 64.

    Product Name: Windows 8.1 Enterprise
    Product ID: 00261-80243-63017-AA195
    Installed Key: NBBBB-BBBBB-BBBBB-BBBBB-BBBBB

    Poorly-rated. Like or Dislike: Thumb up 5 Thumb down 8

    Reply
    1. Sergey Tkachenko Post author

      Probably fails with Enterprise edition. The script was created for Retail OS.

      Hot debate. What do you think? Thumb up 3 Thumb down 5

      Reply
    2. Mateusz Paluszkiewicz

      Change “DigitalID = objshell.RegRead(Path & “DigitalProductId”)” to “DigitalID = objshell.RegRead(Path & “DigitalProductId4″)” for Enterprise

      Well-loved. Like or Dislike: Thumb up 16 Thumb down 3

      Reply
      1. Sergey Tkachenko Post author

        Thank you very much

        Well-loved. Like or Dislike: Thumb up 6 Thumb down 2

        Reply
  4. RonBoyd

    I tried it on six machines. On four (2-Win 8.1 (a laptop and a desktop), 1-Win 7 (laptop), and 1-Vista(desktop)) it worked correctly. On the other two (1-Win 8.1 and 1-Win 8 — both laptops), I received this error message:

    “Unable to open registry key ‘HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId’ for reading.”

    The registry entry does exist — viewing with Regedit.

    Like or Dislike: Thumb up 1 Thumb down 2

    Reply
    1. Sergey Tkachenko Post author

      Hmm
      I can’t reproduce it.

      Like or Dislike: Thumb up 0 Thumb down 2

      Reply
    2. Rivii

      I’ts simple you must be admin or have high enough priviladges to read registry :)

      BTW works for Windows 10 :D

      Like or Dislike: Thumb up 1 Thumb down 1

      Reply
  5. RonBoyd

    And I can reproduce it (the error) on only 40% of my machines.

    Poorly-rated. Like or Dislike: Thumb up 0 Thumb down 4

    Reply
    1. Sergey Tkachenko Post author

      This is very strange, really.

      Poorly-rated. Like or Dislike: Thumb up 0 Thumb down 3

      Reply
  6. mohammad

    thanks bud it really works

    Well-loved. Like or Dislike: Thumb up 5 Thumb down 1

    Reply
  7. sammer003

    works on Win8.1×64 Ent. Evaluation.

    Like or Dislike: Thumb up 2 Thumb down 3

    Reply
  8. windows10user

    Got error because my username is only part of user account foldername (has .%userdomain% attached),
    used userprofile setting instead of username, should also help people with more than 1 windows e.g.
    c: for win7 and d: for winX. ( input “set u” in dosbox to see userprofile )

    ‘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(“%UserProfile%”)
    ‘Create a text file on desktop
    fName = UserName & “\Desktop\WindowsKeyInfo.txt”
    Set fso = CreateObject(“Scripting.FileSystemObject”)
    Set txt = fso.CreateTextFile(fName)
    txt.Writeline Data
    txt.Close
    End Function

    Like or Dislike: Thumb up 0 Thumb down 2

    Reply
  9. marcus

    Great jobs, you save my time for searching the code.

    Like or Dislike: Thumb up 0 Thumb down 1

    Reply
    1. Sergey Tkachenko Post author

      Enjoy.

      Like or Dislike: Thumb up 0 Thumb down 1

      Reply
  10. Indy4fan

    I don’t quite understand this part of the script:


    keypart1 = Mid(KeyOutput, 2, Last)
    insert = "N"
    KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
    If Last = 0 Then KeyOutput = insert & KeyOutput

    Could you please describe how it works? How is the ‘N’ placed at the correct place? And if my product key doesn’t have a ‘N’, will it still work correctly?

    Also, I’ve found out by testing that a Windows 10 key also can consist of a ‘5’. Does the script need to be extended for that purpose?

    Thanks,

    Like or Dislike: Thumb up 1 Thumb down 1

    Reply
    1. Justin

      Perhaps try this on windows 10 as admin:

      wmic path softwarelicensingservice get OA3xOriginalProductKey

      Or run this vbscript:

      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

      I get different results from this vbscript. But when I run the one in the blog post above, it gives me the same key as “wmic path softwarelicensingservice get OA3xOriginalProductKey”

      Like or Dislike: Thumb up 0 Thumb down 1

      Reply
      1. Zul

        I can’t press “N” and it keep saying it an unacceptable character. So does it works with windows 7 too.

        Like or Dislike: Thumb up 0 Thumb down 1

        Reply
  11. kowshick

    am getting product key

    Product Name: Windows 8 Pro

    Installed Key: NBBBB-BBBBB-BBBBB-BBBBB-BBBBB

    Pls help me how to get the original product key which havebeen inserted in my laptop

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  12. mike

    thanx for the trick hahahahahahahahahaahahahah

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  13. pcklaus61

    Hey with this script i can read the Key from Win10Pro but the Key is on all Computer i have seen the same Key this detected Key (VK7JG-NPHTM-C97JM-9MPGT-3V66T) is a generic Key and it is useful for install Windows 10 clean but for Activation is this Key not possible.
    I have read an other a different key in my System with “Token Restore” v. 2.2 for Win7 and the same key i have read with ProduKey.exe (2011version) and keyfinder.exe ( from 2009) but i dont have try this Key for Activate while my Win10Pro is 100% activated directly after Upgrade from Win8.1Pro

    Like or Dislike: Thumb up 3 Thumb down 0

    Reply
    1. Turkish Force

      Hi . Soo thank you my friend

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  14. Terry

    I found that it worked fine on my Windows 10 desktop. However a simpler way to get the same result is to use Belarc Advisor. This gives all manner of information, including all software codes.

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
    1. Belarc 50-50

      I am not sold 100% on Belarc, it only pulls Operating System and Office Suite Keys 50% of the time.

      I will try this out on Operating Systems and see how it fairs.

      :)

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  15. Hoshiyar singh

    How can find product key of windows 8.1 pre loaded

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  16. Aaron

    Thanks for sharing. I have a try on a notebook with Windows version Vista Business. It is strange that the key reproduced is a bit different from the one I input on activation (which is printed on the bottom on my mechine).

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  17. Prajyot

    Thanks.. Worked for me on Windows-10 x64 based OS.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  18. Munish

    This Script worked for me. Great work.
    Much appreciated

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  19. Angela

    AWESOMESAUCE!

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  20. manas

    if u want to check windows 10 home edition key will work or not, just go to notification, then windows update, then activation. type the key shown by your pc, if u got message to activate then that product key will work.
    & Thanks for that code. :)

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  21. Alastair

    Thank you very much for this useful script and the clear instuctions.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      don’t mention it.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  22. Aaron

    This could be improved a bit by allowing the user to select where to save the info via:

    http://www.robvanderwoude.com/vbstech_ui_fileopen.php

    As it stands, the script gives me permission errors when trying to save to the folder you specify since C:\Users isn’t always the home directory for a user.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Aaron

      Actually that link has code that only works for WinXP not other versions. The following link should be better:

      http://blogs.technet.com/b/heyscriptingguy/archive/2005/06/17/how-can-i-show-users-a-dialog-box-that-only-lets-them-select-folders.aspx

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  23. drac

    Thank!!, fantastic script. From Catalonia. I incorpored to my librery tools (KKTOOLS).

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  24. FigeritOut

    Hello,
    Here I have the full code to view any windows key also the ones they put in the bios.
    It’s written in Visual Basic 2008, but you maybe can transform it in later versions.
    Here we go:
    Create a form with 2 textboxes called Textbox1 & Textbox2
    One Exitbutton called Button1
    The paste in following code:

    Public Class Form1
    Inherits System.Windows.Forms.Form
    #Region ” Windows Form Designer generated code ”
    #End Region
    Public Function ShowMyKey(ByVal Path As String, ByVal Name As String) As String

    Dim MessageStyle
    Dim A As Object = My.Computer.Registry.GetValue(Path, Name, 0)
    Dim B As String = “”
    Dim C As String = “”
    Dim D As Integer = 52
    Dim E As Integer = 67
    Dim F(24) As String
    Dim G As Integer = 29
    Dim H As Integer = 15
    Dim J(15) As String
    Dim K(30) As String
    Dim L As String = “”

    If A Is Nothing Then Return “No Value”

    Try
    For i As Integer = LBound(A) To UBound(A)
    B = B & ” ” & Hex(A(i))
    Next
    Catch ex As Exception
    MsgBox(ex.Message, MessageStyle.Crytical)

    End Try

    F(0) = “B” : F(1) = “C” : F(2) = “D” : F(3) = “F” : F(4) = “G” : F(5) = “H”
    F(6) = “J” : F(7) = “K” : F(8) = “M” : F(9) = “P” : F(10) = “Q” : F(11) = “R”
    F(12) = “T” : F(13) = “V” : F(14) = “W” : F(15) = “X” : F(16) = “Y”
    F(17) = “2” : F(18) = “3” : F(19) = “4” : F(20) = “6” : F(21) = “7”
    F(22) = “8” : F(23) = “9”

    Try
    For i = D To E
    J(i – D) = A(i)
    C = C & ” ” & Hex(J(i – D))
    Next
    Catch ex As Exception
    MsgBox(ex.Message, MessageStyle.Crytical)
    End Try
    For i As Integer = G – 1 To 0 Step -1
    If ((i + 1) Mod 6) = 0 Then
    K(i) = “-”
    L = L & “-”
    Else
    Dim M As Integer = 0
    For N As Integer = (H – 1) To 0 Step -1
    Dim O As Integer = ((M * 2 ^ 8) Or J(N))
    J(N) = O \ 24
    M = (O Mod 24)
    Next
    K(i) = F(M)
    L = L & F(M)
    End If
    Next
    Return StrReverse(L)

    End Function
    Public Function ShowMyVersion()
    Dim K As String
    K = My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion”, “ProductName”, Nothing)
    TextBox2.Text = (K)
    End Function
    Function ConvertToKey(ByVal Path As String, ByVal Name As String) As String
    Dim A As Object = My.Computer.Registry.GetValue(Path, Name, 0)
    Const KeyOffset = 52
    Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert
    ‘Check if OS is Windows 8
    isWin8 = (A(66) \ 6) And 1
    A(66) = (A(66) And &HF7) Or ((isWin8 And 2) * 4)
    i = 24
    Maps = “BCDFGHJKMPQRTVWXY2346789”
    Do
    Current = 0
    j = 14
    Do
    Current = Current * 256
    Current = A(j + KeyOffset) + Current
    A(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
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    ShowMyVersion()
    If Strings.Left((TextBox2.Text), 10) = “Windows 10” Then GoTo Volg1
    If Strings.Left((TextBox2.Text), 9) = “Windows 8” Then GoTo Volg1
    If Strings.Left((TextBox2.Text), 11) = “Windows 8.1” Then GoTo Volg1
    TextBox1.Text = ShowMyKey(“HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion”, “DigitalProductID”)
    GoTo Af
    Volg1:
    TextBox1.Text = ConvertToKey(“HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion”, “DigitalProductID”)
    Af:
    Button2.Select()
    If (TextBox1.Text) = “” Then Button2_Click(sender, New System.EventArgs)

    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    On Error GoTo Af
    Dim strComputer As String = “.”
    Dim objWMIService As Object = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
    Dim colBIOS As Object = objWMIService.ExecQuery _
    (“Select * from Win32_BIOS”)
    Dim objBIOS As Object
    Dim i As Integer

    For Each objBIOS In colBIOS
    TextBox2.Text = objBIOS.Data()

    Next
    Af:
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Close()
    End Sub
    End Class

    I hope it works for You.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  25. FigeritOut

    Sorry, forgot something, You also need a button called Button2, but You can make this one invisible or You can arrange the code so You can elliminate this button.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  26. George

    Thank you very much. It worked…

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      you are welcome.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  27. Siby Varghese

    Thanks man
    alot of thanks

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      don’t mention it.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  28. Mthoko

    How do i write 0,1,A and E my product id include all of these characters for windows 10

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      means?

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  29. bobsyouruncle

    thanks this worked like a charm , great script – windows 10 pro from win 7

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  30. GugaMM

    Thanks man..

    It worked excelent!!!

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
  31. emon

    will you give me the product key of windows 10?

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  32. Panchapakesan V Iyer

    Amazing!! It worked for me on Windows Pro 10. Thanks for the amazing work.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  33. Pete Lotas

    Worked a treat…Thanks great work

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  34. therealtruth

    The key that comes using this method didn’t work for me for windows 8 pro. Microsoft says that the eky I got was a windows 8 home key and not a professional version key. Any workarounds?

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  35. Maria

    Thanks. Worked perfectly!!!

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  36. Aritra Nath

    It can also be made to work with Windows XP by modifying the script a bit….

    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,UserDesktop
    Set objshell = CreateObject(“wscript.shell”)
    ‘Get current user name
    UserDesktop = objshell.ExpandEnvironmentStrings(“%USERPROFILE%\Desktop”)
    ‘Create a text file on desktop
    fName = UserDesktop & “\WindowsKeyInfo.txt”
    Set fso = CreateObject(“Scripting.FileSystemObject”)
    Set txt = fso.CreateTextFile(fName)
    txt.Writeline Data
    txt.Close
    End Function

    Like or Dislike: Thumb up 3 Thumb down 1

    Reply
    1. Rajan

      That was really helpful, thanks for the modification…

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  37. Honore'

    Thanks Sergey,

    GREAT JOB!!!
    It works like a charm.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  38. selvakumar

    Thank you for providing the method for backup of windows 10 keys sir you own the internet

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      you are welcome

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  39. Alex

    Wow it worked great. Thank you for providing this method, but I have a problem here. When I check in Setting/Update & security/Activation, it shows my product key : XXXXX-XXXXX-XXXXX-XXXXX-ABCEF (well it’s not my real product key but something like that with the last 5 characters are shown). And when I run your script, it shows me a key THGFE-TFNDH-4HFTD-FHRT6-SHFGD (it’s not my real key too). But my point is do those 2 keys suppose to have the same last 5 characters ? In my case, they are different. Is that normal ? If I reinstall windows 10, still I can use the key your script gave me to reactive windows ?

    Like or Dislike: Thumb up 3 Thumb down 0

    Reply
    1. Daniel

      I’m wondering also, because mine do not match.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
    2. Bob

      If you got Win10 as a free upgrade then any key you retrieve will be useless because it is totally generic. That is, all free Win10 Home upgraders have the same key, and similarly free Win10 Pro upgraders have the same key.

      Win10 stores your hardware info on MS’ servers so whenever you want to reinstall just skip the key and it will automatically reactivate after connecting to the net and comparing your current hardware info with the stored value. (You can actually change your hard disk and most other things but if you change your motherboard with another model then the activation will fail.)

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  40. Satzt

    Hi all, here is the simplest solution:

    press windows key, type in “product key”, the results will show you option under settings: “change your windows product key”

    Click that option.
    Then scroll down & get your last 5 characters of your key, copy this or write it down.

    then press windows key & type : “regedit”

    registry will open, now press cntrl+f to search registry.

    Type in your 5 keys obtained earlier here, then press find…Then Volia…your key will be displayed on right side of screen. (25 Characters long)

    Thats it…eezi peezi… :-) ;-)

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
  41. Daniel

    Why does my partial product key (last 5 characters) that is shown under Windows 10 Settings not match at all with what this tool shows me ?

    Also, what is the key that is shown in the registry under “BackupProductKeyDefault” in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform ?

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  42. harris

    Super…that worked ,thank you.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  43. Antonio

    Tried the vbs script here and the powershell script at http://winaero.com/blog/how-to-get-the-windows-product-key-without-using-third-party-software. Both produced a different product keys. By comparing the 5 characters in the Activation tab on Windows 10, it seems that the vbs one is the correct one.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  44. t

    There seems to be something wrong with the vbs script posted on the winaero site:
    http://winaero.com/blog/how-to-view-your-product-key-in-windows-10-windows-8-and-windows-7/

    I have tried this script on several win7 PCs, and the key it displays does not agree with the key shown by other similar utilities such as WinKeyFinder or MagicJellyBean.

    The following all display the same key:
    http://www.winkeyfinder.com/download/winkeyfinder-download/download-win-keyfinder-2-0-beta-1.php
    https://www.magicaljellybean.com/keyfinder/
    http://www.howtogeek.com/206329/how-to-find-your-lost-windows-or-office-product-keys/

    Either your script has a bug or all these other utilities are wrong. The last one on the list is also a similar vbs script, although shorter than the one on your site.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. t

      …also the win7 keys produced by your script are invalid according to the Ultimate PID Checker:
      http://janek2012.eu/ultimate-pid-checker/

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
      1. Sergey Tkachenko Post author

        Thank you very much.
        It was a bug in the script.
        The missing part was as follows

        If (isWin8 = 1) Then 
                keypart1 = Mid(KeyOutput, 2, Last) 
                insert = "N" 
                KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0) 
                If Last = 0 Then KeyOutput = insert & KeyOutput 
            End If 

        I corrected it, now it works fine.

        Like or Dislike: Thumb up 0 Thumb down 0

        Reply
  45. Bob

    I remember seeing this same VBS a long time back on another site where the original poster had figured out the decryption algo. Forget which one now… But in any case you should credit the original source you took it from.

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      OK, do you remember the original author?
      Try to google it. Many web sites keep posting the script without credits. Hard to find the original author.

      Actually, I have this script for ages in my collection of scripts and just do not remember where I grabbed it.
      It was several years ago.
      Just as much as I want to credit original author, I don’t want to credit the WRONG PERSON as author.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
      1. Sergey Tkachenko Post author

        Thanks to MDL, the original author was found.
        The credits link is set.

        Like or Dislike: Thumb up 0 Thumb down 0

        Reply
  46. tedrsak

    Great. I can find Key Windows 10 Pro in my pc.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  47. Phil

    can i do this other method?
    http://i.imgur.com/XAXWwIP.png

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      Yes you can.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
      1. Phil

        thank you

        Like or Dislike: Thumb up 0 Thumb down 0

        Reply
        1. Sergey Tkachenko Post author

          you are welcome.

          Like or Dislike: Thumb up 0 Thumb down 0

          Reply
  48. amstog

    thank you man awesome

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
  49. Kevin Ruffus

    I have my user folders on another drive, so the save feature didn’t work at all.

    After a little searching, and banging my head against the keyboard repeatedly (I’ve never touched VBScript before), I was able to merge your script and some code from a forum to 1) remove the user name and profile search entirely, and 2) get the script to save the file to my desktop, even though my user profile is on a secondary physical drive.

    I’m testing on Windows 7, and can’t quickly test it on 8 or 10.

    Here’s the modified script:
    Show/Hide

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Kevin Ruffus

      I noticed some of your fixes were missing, so I added those back in:
      Show/Hide

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
      1. Kevin Ruffus

        I think I’ve built in a test for Enterprise, based on the info from Mateusz and some Googling about how to test if a reg entry exists.

        Show/Hide

        Like or Dislike: Thumb up 0 Thumb down 0

        Reply
        1. Sergey Tkachenko Post author

          Thank you very much for sharing the code.

          Like or Dislike: Thumb up 0 Thumb down 0

          Reply
          1. Kevin Ruffus

            Tried to clean it up a bit and stick closer to the original style. Updated the check for Enterprise so it makes more sense when simply reading it. I’m only posting that section this time, as nothing else was changed.

            'Registry key value
            DigitalID = objshell.RegRead(Path & "DigitalProductId")
            Dim ProductName, ProductID, ProductKey, ProductData, Enterprise
            'Get ProductName, ProductID, ProductKey, check if Enterprise
            ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName")
            On Error Resume Next
            sValue = objshell.regread(Path & "ProductID4")
            If Err.Number 0 Then
            Err.Clear
            Enterprise = False
            Else
            Err.Clear
            Enterprise = True
            End If
            On Error goto 0
            If Enterprise = True then
            ProductID = "Product ID: " & objshell.RegRead(Path & "ProductID4")
            Else
            ProductID = "Product ID: " & objshell.RegRead(Path & "ProductID")
            End If

            Like or Dislike: Thumb up 0 Thumb down 0

  50. tufkyd

    Works great for me! Good Job! (Y)
    Thanks !

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  51. Ellie

    Simple and elegant solution… thank you.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *