This post was last updated on November 7th, 2020 at 06:54 pm
If you are trying to upgrade/reinstall Windows OS(operating system) or may want to move the Windows copy to a new PC (Personal Computer), you may(because the product key for some version of Windows comes with embedded in the computer’s UEFI firmware or BIOS) require typing the Windows key.
But if you lost or forgot where you had stored the product key of your Windows 10/ Windows 8 / Windows 7 OS, do not despair, you can still recover it from the computer on which it’s installed. You should first read this article to find your Windows product key and store it somewhere safely.
I have shown 2 simple solutions to extract your product key from the OS installed on your PC.
Let's find Windows 10, 8, 7 product key
Use NirSoft’s ProduKey to Recover Windows product key
The easy method to get the product key is "Nirsoft's ProduKey" a third-party program which instantly find Product ID and Key of all Microsoft applications installed on your system.
Note: As it is a tool to extract Microsoft applications keys, some anti-viruses might flag this program as a virus or malware, but you can put your full trust in this program - it's safe and clean, you don’t have to worry about viruses or malware.
Windows product key without using third party software
- First open Notepad or any other text editor, I prefer Notepad++ (Best free alternative to Notepad).
- Copy and paste the following code in the Notepad. The code may seem ugly, lengthy or you may not understand but nothing to worry, it is VBScript(Visual Basic Script, developed by Microsoft).
- Save the file to the desktop for easy access. Make sure to change the “Save as type” to “All Files” and then name it ProductKeyInfo.vbs or something similar but ending with the "
.vbs" extension. For extra sure type the File name enclosed in double quotes, for example, "ProductKeyInfo.vbs"
'* Script: Windows Key Information '* https://www.proy.info * '* Modified On 02/01/2017 * '*********************************** Dim strComputer, objWMIService, objItem, Caption, colItems, ProductData, OSVersion, InstallDate, RegisteredUser, ProductID, systemOsType Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime") strComputer = "." Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48) For Each objItem in colItems Caption = objItem.Caption OSVersion = Trim(objItem.Caption) & " (Build " & objItem.Version & ")" dtmConvertedDate.Value = objItem.InstallDate InstallDate = dtmConvertedDate.GetVarDate RegisteredUser = objItem.RegisteredUser ProductID = Trim(objItem.SerialNumber) Next 'Find Processor architecture Set WshShell = CreateObject("WScript.Shell") OsType = WshShell.RegRead("HKLMSYSTEMCurrentControlSetControlSession ManagerEnvironmentPROCESSOR_ARCHITECTURE") If OsType = "x86" then systemOsType = "32-bit Operating System" elseif OsType = "AMD64" then systemOsType = "64-bit Operating System" end if Function WindowsKey Set WshShell = CreateObject("WScript.Shell") Key = WshShell.RegRead("HKLMSOFTWAREMicrosoftWindows NTCurrentVersionDigitalProductId") 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 WindowsKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5) & "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & Mid(KeyOutput, 21, 5) End Function ProductData = OSVersion & vbNewLine & systemOsType & vbNewLine & vbNewLine & "Install Date: " & InstallDate & vbNewLine & "Registered To: " & RegisteredUser & vbNewLine & "Windows PID: " & ProductID & vbNewLine & "Windows Key: " & WindowsKey 'Show messbox if save to a file If vbYes = MsgBox(ProductData & vblf & vblf & "Click Yes to save these information to a file?", vbYesNo + vbQuestion, "BackUp Windows Key Information") then Save ProductData End If '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 & "DesktopWindowsKeyInfo.txt" Set fso = CreateObject("Scripting.FileSystemObject") Set txt = fso.CreateTextFile(fName) txt.Writeline Data txt.Close End Function
- Now click the file "ProductKeyInfo.vbs" on your desktop and a pop-up will show up with your Windows Product Key with other related information. Just like below.
The main code is from Microsoft's script center. I made some changes to include more information.
You can post comments in this post.
nice artilce , thank you Admin . keep it up have a great day
Tobi Baver 3 years ago
Leave A Reply