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.

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

  1. Dave Johnson

    Awesome!

    Reply
    1. Sergey Tkachenko Post author

      Yep, very nice trick

      Reply
    2. Franco

      Thanks man, great Sergio

      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!

      Reply
    4. 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)

      Reply
    5. Milind SHroff

      Worked wonders…!! Thanks a lot.

      Reply
    6. Bob

      LMAO Microsoft’s own support team sent me here XDD

      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!!!

    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

    Reply
    1. Sergey Tkachenko Post author

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

      Reply
    2. Mateusz Paluszkiewicz

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

      Reply
      1. Sergey Tkachenko Post author

        Thank you very much

        Reply
      2. Juan Carlos

        This fix makes it work for Windows 10 Pro. Thaks!!!

        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.

    Reply
    1. Sergey Tkachenko Post author

      Hmm
      I can’t reproduce it.

      Reply
    2. Rivii

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

      BTW works for Windows 10 :D

      Reply
  5. RonBoyd

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

    Reply
    1. Sergey Tkachenko Post author

      This is very strange, really.

      Reply
  6. mohammad

    thanks bud it really works

    Reply
  7. sammer003

    works on Win8.1×64 Ent. Evaluation.

    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

    Reply
  9. marcus

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

    Reply
    1. Sergey Tkachenko Post author

      Enjoy.

      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,

    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”

      Reply
      1. Zul

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

        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

    Reply
  12. mike

    thanx for the trick hahahahahahahahahaahahahah

    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

    Reply
    1. Turkish Force

      Hi . Soo thank you my friend

      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.

    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.

      :)

      Reply
  15. Hoshiyar singh

    How can find product key of windows 8.1 pre loaded

    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).

    Reply
  17. Prajyot

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

    Reply
  18. Munish

    This Script worked for me. Great work.
    Much appreciated

    Reply
  19. Angela

    AWESOMESAUCE!

    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. :)

    Reply
  21. Alastair

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

    Reply
    1. Sergey Tkachenko Post author

      don’t mention it.

      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.

    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

      Reply
  23. drac

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

    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.

    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.

    Reply
  26. George

    Thank you very much. It worked…

    Reply
    1. Sergey Tkachenko Post author

      you are welcome.

      Reply
  27. Siby Varghese

    Thanks man
    alot of thanks

    Reply
    1. Sergey Tkachenko Post author

      don’t mention it.

      Reply
  28. Mthoko

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

    Reply
    1. Sergey Tkachenko Post author

      means?

      Reply
  29. bobsyouruncle

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

    Reply
  30. GugaMM

    Thanks man..

    It worked excelent!!!

    Reply
  31. emon

    will you give me the product key of windows 10?

    Reply
  32. Panchapakesan V Iyer

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

    Reply
  33. Pete Lotas

    Worked a treat…Thanks great work

    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?

    Reply
  35. Maria

    Thanks. Worked perfectly!!!

    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

    Reply
    1. Rajan

      That was really helpful, thanks for the modification…

      Reply
  37. Honore'

    Thanks Sergey,

    GREAT JOB!!!
    It works like a charm.

    Reply
  38. selvakumar

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

    Reply
    1. Sergey Tkachenko Post author

      you are welcome

      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 ?

    Reply
    1. Daniel

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

      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.)

      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… :-) ;-)

    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 ?

    Reply
  42. harris

    Super…that worked ,thank you.

    Reply
  43. Antonio

    Tried the vbs script here and the powershell script at https://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.

    Reply
  44. t

    There seems to be something wrong with the vbs script posted on the winaero site:
    http://www.minimandarin.com.au/?view=

    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.

    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/

      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.

        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.

    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.

      Reply
      1. Sergey Tkachenko Post author

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

        Reply
  46. tedrsak

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

    Reply
  47. Phil

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

    Reply
    1. Sergey Tkachenko Post author

      Yes you can.

      Reply
      1. Phil

        thank you

        Reply
        1. Sergey Tkachenko Post author

          you are welcome.

          Reply
  48. amstog

    thank you man awesome

    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

    Reply
    1. Kevin Ruffus

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

      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

        Reply
        1. Sergey Tkachenko Post author

          Thank you very much for sharing the code.

          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

  50. tufkyd

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

    Reply
  51. Ellie

    Simple and elegant solution… thank you.

    Reply
  52. Greg Smith

    Worked perfect. NIRSOFT PRODUKEY failed on this, but your script got a correct key instead of an “invalid” key.
    Was able to run the Windows 10 Pro Upgrade after replacing a hard drive.
    Thank you !!!

    Reply
  53. haryo

    work great! thanks to the source, whoever you are man (or woman)!

    Reply
  54. Sophal

    That’s awesome! love that trick

    Reply
  55. itwxwoodx

    I put this script thru 4 different win 10 machines and it gave the exact same key every time

    Reply
  56. Murshed

    That’s great job..excellent, thank you so much…….

    Reply
  57. Paul Ishak

    Here is a modified version for Visual Basic, all wrapped into 1 function.

    Option Strict On
    Option Explicit On
    Option Infer Off
    Imports Microsoft.Win32
    Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    RichTextBox1.Text = RichTextBox1.Text & GetProductID() & vbCrLf
    End Sub
    Function GetProductID() As String
    Dim regKey As RegistryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)
    Dim rkey As RegistryKey = regKey.OpenSubKey(“SOFTWARE\Microsoft\Windows NT\CurrentVersion\”)
    Dim Key As Byte() = DirectCast(rkey.GetValue(“DigitalProductID”), Byte())
    Dim KeyOffset As Integer = 52
    Dim isWin8 As Byte = CByte((Key(66) \ 6) And 1)
    Dim Maps As String = “BCDFGHJKMPQRTVWXY2346789”
    Dim KeyOutput As String = String.Empty
    Dim Last As Integer
    Dim keypart1 As String
    Dim insert As String
    Key(66) = CByte((Key(66) And &HF7) Or ((isWin8 And 2) * 4))
    Dim i As Integer = 24
    Do
    Dim Current As Integer = 0
    Dim j As Integer = 14
    Do
    Current = Current * 256
    Current = Key(j + KeyOffset) + Current
    Key(j + KeyOffset) = CByte((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
    Return Mid(KeyOutput, 1, 5) & “-” & Mid(KeyOutput, 6, 5) & “-” & Mid(KeyOutput, 11, 5) & “-” & Mid(KeyOutput, 16, 5) & “-” & Mid(KeyOutput, 21, 5)
    End Function
    End Class

    Reply
  58. Sarah

    Would this be able to be adapted for finding the product key for Microsoft Office 2016 in Windows 10? I have a lifetime license but lost the product key, and I’m having serious error messages in Microsoft and would like to reinstall. However, Microsoft is telling me I’d have to rebuy the software… if I could just view my product key that would be amazing.

    Thank you so much for your help, this is an invaluable site!

    Reply
  59. Euráclito

    Buenísisisisimo! Gracias

    Reply
  60. FirstStrike

    copy paste and run in PowerShell
    (Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey

    Reply
  61. Andrey_Goblin

    Set WshShell = CreateObject(“WScript.Shell”)
    regKey = “HKLMSOFTWAREMicrosoftWindows NTCurrentVersion”
    DigitalProductId = WshShell.RegRead(regKey & “DigitalProductId”)

    Win8ProductName = “Windows Product Name: ” & WshShell.RegRead(regKey & “ProductName”) & vbNewLine
    Win8ProductID = “Windows Product ID: ” & WshShell.RegRead(regKey & “ProductID”) & vbNewLine
    Win8ProductKey = ConvertToKey(DigitalProductId)
    strProductKey =”Windows 8 Key: ” & Win8ProductKey
    Win8ProductID = Win8ProductName & Win8ProductID & strProductKey

    Function ConvertToKey(regKey)
    Const KeyOffset = 52
    isWin8 = (regKey(66) 6) And 1
    regKey(66) = (regKey(66) And &HF7) Or ((isWin8 And 2) * 4)
    j = 24
    Chars = “BCDFGHJKMPQRTVWXY2346789”
    Do
    Cur = 0
    y = 14
    Do
    Cur = Cur * 256
    Cur = regKey(y + KeyOffset) + Cur
    regKey(y + KeyOffset) = (Cur 24)
    Cur = Cur Mod 24
    y = y -1
    Loop While y >= 0
    j = j -1
    winKeyOutput = Mid(Chars, Cur + 1, 1) & winKeyOutput
    Last = Cur
    Loop While j >= 0
    If (isWin8 = 1) Then
    keypart1 = Mid(winKeyOutput, 2, Last)
    insert = “N”
    winKeyOutput = Replace(winKeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
    If Last = 0 Then winKeyOutput = insert & winKeyOutput
    End If
    a = Mid(winKeyOutput, 1, 5)
    b = Mid(winKeyOutput, 6, 5)
    c = Mid(winKeyOutput, 11, 5)
    d = Mid(winKeyOutput, 16, 5)
    e = Mid(winKeyOutput, 21, 5)
    ConvertToKey = a & “-” & b & “-” & c & “-” & d & “-” & e
    End Function
    set filesys = CreateObject(“Scripting.FileSystemObject”)
    set filetxt = filesys.OpenTextFile(“Key Windows.txt”, 8, True)
    filetxt.WriteLine(Win8ProductName)
    filetxt.WriteLine(Win8ProductKey)
    filetxt.WriteBlankLines 1

    Reply
  62. Gwen Francesconi

    Thank you so much, my new notebook came preinstall with not recovery disks just a recovery image. I downloaded the iso file for it, Used the Script file you wrote and it worked perfectly.
    Regards
    Gwen

    Reply
  63. Jeff Silva

    worked perfectly on my sony laptop…..do you have any way of reading product numbers on a win 7 home premium install disk i used authintic win 7 disk but i found those key numbers on line and now the pro id dont match the prod key.so what i need is the nunbers off the disk

    Reply
  64. alfa

    my pc status is
    Product Name: Windows 8.1
    Product ID: 00259-60600-00001-AA474
    Installed Key: 334NH-RXG76-64THK-C7CKG-D3VPT
    and it wouldn’t work.
    please help me.

    Reply
  65. Mahdi Hedhli

    Nice script, TY. Had an error as the path to my user profile wasn’t the same as my username. Modified the script so that it would go to the user profile desktop even if the path is different of it it’s on a drive other than C by using the %UserProfile% variable instead. Changes below:

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

    Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.