2 ways to back up Product Key on Windows 10, 8 and 8.1
When your Windows operating system has some critical errors or crashes, . often the solution to fix the error is to reinstall the operating system. And Windows users will have to use Product Key to reinstall the operating system. However, to 'buy' a Product Key you will need to pay a decent fee.
If you do not want to pay any fee, it is best to back up the Product Key or Activation Key in case something goes wrong. In the article below, Network Administrator will guide you 2 ways to back up Product Key on Windows 10, 8 and Windows 8.1.
In addition, readers can refer to the article 5 how to change the Product key on Windows 10 here.
1. Backup Product Key on Windows 10, 8 and Windows 8.1
Follow the steps below to back up Product Key on Windows 10, 8 and Windows 8.1:
Step 1:
Press the Windows + R key combination to open the Run command window, then on the Run window, enter " notepad " there and press Enter or click OK to open a new Notepad.
Step 2:
On the new Notepad, copy and paste the following script into:
#Main function
Function GetWin8Key
{
$ Hklm = 2147483650
$ Target = $ env: COMPUTERNAME
$ regPath = "SoftwareMicrosoftWindows NTCurrentVersion"
$ DigitalID = "DigitalProductId"
$ wmi = [WMIClass] "$ Targetrootdefault: stdRegProv"
#Get registry value
$ Object = $ wmi.GetBinaryValue ($ hklm, $ regPath, $ DigitalID)
[Array] $ DigitalIDvalue = $ Object.uValue
#If get successed
If ($ DigitalIDvalue)
{
#Get producnt name and product ID
$ ProductName = (Get-itemproperty -Path "HKLM: SoftwareMicrosoftWindows NTCurrentVersion" -Name "ProductName"). ProductName
$ ProductID = (Get-itemproperty -Path "HKLM: SoftwareMicrosoftWindows NTCurrentVersion" -Name "ProductId") ProductId
#Convert binary value to serial number
$ Result = ConvertTokey $ DigitalIDvalue
$ OSInfo = (Get-WmiObject "Win32_OperatingSystem" | select Caption) .Caption
If ($ OSInfo -match "Microsoft Windows 8" -or $ OSInfo -match "Microsoft Windows 10")
{
if ($ Result)
{[string] $ value = "ProductName: $ ProductName` r`n "`
+ "ProductID: $ ProductID` r`n "`
+ "Installed Key: $ Result"
$ value
#Save Windows info to một tập tin
$ Choice = GetChoice
If ($ Choice -eq 0)
{
$ txtpath = "C: Users" + $ env: USERNAME + "Desktop"
New-Item -Path $ txtpath -Name "WindowsKeybackup.txt" -Value $ value -ItemType File -Force | Out-Null
}
Elseif ($ Choice -eq 1)
{
Exit
}
}
Else
{
Write-Warning "Please run this script on Windows 8.x or Windows 10"
}
}
Else
{
Write-Warning "Please run this script on Windows 8."
}}
Else
{
Write-Warning "Failed to get Windows 8 product key, Some error occured."
}}
#Get user choice
Function GetChoice
{
$ yes = New-Object System.Management.Automation.Host.ChoiceDescription "& Yes", ""
$ no = New-Object System.Management.Automation.Host.ChoiceDescription "& No", ""
$ choices = [System.Management.Automation.Host.ChoiceDescription []] ($ yes, $ no)
$ caption = "Confirming"
$ message = "Save product key to a file?"
$ result = $ Host.UI.PromptForChoice ($ caption, $ message, $ choices, 0)
$ result
}
#Convert binary to serial number
Function ConvertToKey ($ Key)
{
$ Keyoffset = 52
$ isWin8 = [int] ($ Key [66] / 6) -band 1
$ HF7 = 0xF7
$ Key [66] = ($ Key [66] -band $ HF7) -bOr (($ isWin8 -band 2) * 4)
$ i = 24
[String] $ Chars = "BCDFGHJKMPQRTVWXY2346789"
by
{
$ Cur = 0
$ X = 14
Do
{
$ Cur = $ Cur * 256
$ Cur = $ Key [$ X + $ Keyoffset] + $ Cur
$ Key [$ X + $ Keyoffset] = [math] :: Floor ([double] ($ Cur / 24))
$ Cur = $ Cur% 24
$ X = $ X - 1
} while ($ X -ge 0)
$ i = $ i- 1
$ KeyOutput = $ Chars.SubString ($ Cur, 1) + $ KeyOutput
$ last = $ Cur
} while ($ i -ge 0) $ Keypart1 = $ KeyOutput.SubString (1, $ last)
$ Keypart2 = $ KeyOutput.Substring (1, $ KeyOutput.length-1)
if ($ last -eq 0)
{
$ KeyOutput = "N" + $ Keypart2
}
else
{
$ KeyOutput = $ Keypart2.Insert ($ Keypart2.IndexOf ($ Keypart1) + $ Keypart1.length, "N")
}
$ a = $ KeyOutput.Substring (0.5)
$ b = $ KeyOutput.substring (5.5)
$ c = $ KeyOutput.substring (10.5)
$ d = $ KeyOutput.substring (15.5)
$ e = $ KeyOutput.substring (20.5)
$ keyproduct = $ a + "-" + $ b + "-" + $ c + "-" + $ d + "-" + $ e
$ keyproduct}
GetWin8Key
Step 3:
Select the storage location and place any name for the file and remember to add the extension .ps1 (remove the .txt extension).
For example:
If you want to name the file Windowsbackupproductkey , then you enter the full name in the File name frame, Windowsbackupproductkey.ps1 .
Click Save to save the file.
Step 4:
Right-click the file you just created, then select Run with PowerShell .
Step 5:
PowerShell will ask you to confirm whether you want to save a Productkey copy on your computer. Enter Y and press Enter to confirm.
Step 6:
The Product Key that you back up on Windows 10, 8.1 and 8 will be saved in the WindowsKeybackup.txt file on your computer.
2. PowerShell Script to back up Product Key on Windows 10, 8.1 and 8
In addition to the above, you can download PowerShell Script to back up Product Key on Windows 10, 8.1 and 8.
Download PowerShell Script to your computer here.
Step 1:
Unzip the WindowsKeybackup.rar file that you just downloaded.
Step 2:
Right-click the file named windowsbackupproductkey.ps1 and select Run with PowerShell .
Step 3:
Enter Y in the PowerShell window and press Enter.
And now you can see the Product Key that you backed up on Windows 10, 8.1, and 8 computers.
Refer to some of the following articles:
- How to find the Product key on Windows 8 or Windows 8.1?
- Instructions for linking Windows 10 Product key to Microsoft account
- No need to install any software, this is how to find the Windows Product Key
Good luck!
You should read it
- No need to install any software, this is how to find the Windows Product Key
- How to deactivate Windows Product Key and use it on another computer?
- How to find the Product Key on Windows 11
- How to find the product key of Windows 7
- 5 ways to enter the Windows 10 key the easiest
- How to Find Your Windows 7 Product Key
- How to use the kernel function (PRODUCT function) in Excel
- Free Windows 10 Product Key for Windows 10 Home, Education ,Pro
May be interested
- 14 free and useful applications for Windows should be installed14 most popular and useful applications you should install on your window.
- Adjust screen resolution on Windows 10/8/7on windows 7 and windows 8, screen resolution management can be said to be quite simple. by default on windows 10/8/7, you can choose to display display resolution, refresh rate (screen refresh rate) and color according to your screen.
- Add Command Prompt to Power User Menu on Windows 10on windows 10 build 14971, microsoft replaced command prompt and command prompt (admin) with windows powershell. according to microsoft, this change will bring the best command line experience to users. but in fact, users prefer to use command prompt rather than using powershell.
- Activate to open the settings page (Share page) hidden on the Windows 10 Settings applicationon windows 10 with integrated features share page. however for some reason this feature is hidden in the settings app. if you want to customize flyout when you click on the share button on microsoft edge, windows store application or file explorer, you can enable the hide page feature on the windows settings application. to do this, please refer to the following article of network administrator.
- 8 'tweak' Windows Group Policy any Admin should knowwindows group policy is a powerful tool used to configure many aspects of windows. most tweaking of windows group policy only admin can do. if you are an administrator of many other computers in your company or you have many other accounts on your computer, then you should take advantage of windows group policy to control other users' computer usage.
- How does Windows stop adding '- Shortcut' to the file name Shortcut?normally when creating a new shortcut on your windows computer, windows will automatically add '- shortcut' to the end of the shortcut file name. sometimes this makes users feel uncomfortable, and aesthetics of the shortcut. in the following article, network administrator will show you how to stop windows from adding - shortcut to file name shortcut.