Neat way to find your Windows Product Code on your PC

Type the following in Notepad & then save it as:
Product Code.vbs on your Desktop or where you want it.

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

Then run it. It will display your Product Code.

Reference from:

That’s cool, but there’s an easier way for Win 10 and Win11.

Win+R
regedit

  1. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform

  2. Open the BackupProductKeyDefault key

You can copy the Windows 10 or 11 product key from there

1 Like

There are programs that can display product keys for a variety of installed MS products as well.

Magical JellyBean KeyFinder
The free version will return a Windows Product Key.

1 Like

This knowledge is not necessary to play MSFS so I don’t understand why OP created this topic :thinking:

1 Like

It’s very relevant to me. I’m going do a clean install to a new computer.
I used Windows 11 Media Creation Tool to create the installer.
I need to know the Product Key on the old (to be retired) computer in order to activate Windows on the new one.

Windows will activate automatically after connecting to the internet (it will retrieve the key from your Microsoft account), so you don’t need the old system key to install Windows 10/11 :wink:

3 Likes

Will it do that if I remove my old computer from my Microsoft account before installing Windows on my new computer?

Worst case, I’ll have a hard copy backup of the key.

If I remember correctly Windows should activate. Anyway, even without this topic, you know how to extract the key from the installed Windows system :wink:

FYI, if you are buying a new PC you should also purchase a new system key for it. Of course, you can use the old key, but it is not fully legal.

That’s not true. Microsoft allows you to move a retail copy of Windows from one computer to another. You just can’t use it on more than one, and you can’t transfer an OEM version.

Yes, that’s why I wrote in this topic to remove the old PC from the Microsoft account.

1 Like

And why I replied with a hearty “Thank You!”
I hadn’t thought of that, and it will save me a major headache when I activate Windows on my new computer.

1 Like

You shouldn’t have any problems activating the old Windows key on the new PC.
FYI, the issue might arise in the future if you have an MSI motherboard and Windows 11. In some cases, after a BIOS update Windows will no longer find a license that matches your device, and you’ll need to reactivate Windows.
This is a known bug because Microsoft software (windows) might think you changed the motherboard or PC. In such cases, you may need to reactivate the system, for example, by phone, as manual activation might not work.

Edit
@BegottenPoet228
I forgot to add that you should install Windows 10 on the new PC if the key was for Windows 10. Then, you can update Windows 10 to Windows 11 for free. If in the future Windows 11 has many bugs affecting Microsoft Flight Simulator, you’ll be able to revert to Windows 10 using the same key.

That’s important advice. On my current system I did just that - installed Win10 and upgraded to Win11. Sounds like I need to do the same thing on the new computer.

Thanks.

1 Like

It is in Germany … Microsoft were challenged in a German court and they lost.

1 Like