Find Windows 10 product key using VB Script

This post will show you how to find your Windows 10 product key using a VB Script. But I have to add that this works on Windows 8.1, Windows 7 and earlier versions too. If for some reason you need to find out your Windows license or serial, then this post is sure to help you find your Windows 10 Product Key.

Find Windows 10 product key

Find Windows 10 product key

Open a Notepad and copy-paste the following:

Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))

Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Cur = 0
x = 14
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

In Save as dialog box, select All files and save this file as a .vbs file, giving it any suitable name like keyfinder.vbs.

Now run this file, and you will see your Windows 10 product key.

Source: Microsoft.

You can also find Windows Product Key using Command Prompt or PowerShell.

If these methods do not work for you, you can also use some free Software Key Finders to recover and save, not just Windows, but even Office, Software, Games serials and license keys.

This post will help you if you want to uninstall the Windows Product Key.

Read our Windows 10 review and become a ninja with these Windows 10 tips and tricks.

Posted by on , in Category Windows with Tags
Anand Khanse is the Admin of, a 10-year Microsoft MVP Awardee in Windows (2006-16) & a Windows Insider MVP. Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.


  1. Felipe Botero

    mil gracias!

  2. Micky hollywood

    ok this is weird, i used this and it showed a different product key to the one which is installed. also the product key that it showed, doesn’t work, this was tested with windows 10 pro

  3. casey wilson

    make it write a text file with the key as well (so you can copy it easily):
    (at the end, insert a line before End Function with this code)

    Const ForWRITING = 2
    Const asASCII = 0
    Dim fso, f, fName, ts
    fName = “Windows Key.txt”
    Set fso = CreateObject(“Scripting.FileSystemObject”)
    fso.CreateTextFile fName
    Set f = fso.GetFile(fName)
    Set f = f.OpenAsTextStream(ForWRITING, asASCII)
    f.Writeline ConvertToKey

    The script needs to be run twice on my computer for some reason to create the text file, but it works.

  4. Andrey

    Just press ctrl+c in message box to copy their content and ctrl+v in notepad to paste it. Yes, it works in anothers message boxes too.

  5. Raymond Presley

    ok so i tried your script AND as a comparison, ran produkey just to see if the 2 pulled the same key… THEY DID NOT, so one or the other or both is wrong.

  6. Shridhar Ambady

    Tried this script and it worked only for some. I have a batch of computers that all have the stickers on them, and most of them matched up, but a couple didn’t so I can’t say I can trust this 100%.

  7. anonym

    this is not work, i use this script and get the key. then reinstalling my windows 10 and activate it but microsoft say it invalid key. now my windows 10 original key is gone. so sad …


  8. ArmedPatriot

    I dont like installing anything I get off the web. Last two times I have Ive gotten viruses even after scanning the download. The VBS script is just easier and safer.

  9. diwul62

    I am not sure about the above script…

    I have created a keyfinder.vbs as suggested, after copy pasting above text.
    when running the script it got me a key alright.
    BUT… totally, totally different than the actual key, not 1 group of 5 characters is the same.
    Produkey retrieved the correct key.
    I know, because I have the key on the Windows retail box here.

    AFAIK after upgrading from Windows 7 or 8 to Windows 10, there are 2 keys: installed key and original key. It also shows original Windows version and Prod.ID.

    I tried that once in the past, the original key and original edition were correctly shown.

    All these keyfinders they are blocked by A/V tools.

    Wish there was a decent .vbs script doing the same as ShowKeyPlus.


  10. kofbaow

    UUkeys Product Key Finder can scan all license keys on a computer within a minute. You can give it a try if you don’t like using VB script.

  11. JOJOdu29

    avec votre code j’obtiens une clef ! OK

    Avec ce code-ci :
    Set WshShell = CreateObject(“WScript.Shell”)
    MsgBox (WshShell.RegRead(“HKLMSOFTWAREMicrosoftWindows NTCurrentVersionSoftwareProtectionPlatformBackupProductKeyDefault”))

    j’obtiens une clef différente !!!!!!

    WHY ???

  12. Jeffery Chapman

    Can’t you just open System in the Control Panel and it shows you your Product ID under the Windows Activation heading?

  13. Mitchell William

    i beleive that is the type of windows you are running and not the actual product key, ie i am a human and my SS number is different than human??


  14. loadedmind

    Doesn’t work.

  15. VBS GitHub

    Better script:

  16. Bart Vandecandelaere

    VB script worked like a charm

Leave a Reply

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

7 + 6 =