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
- How to find the Product key on Windows 8 or Windows 8.1?
- How to Recover a Lost Product Key from Your Windows Operating System
- 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
- Windows Product Key Restore
- HP introduces laptops for students
Maybe you are interested
8 settings to change to make your Mac trackpad and keyboard work like Windows
6 ways to fix arrow keys not working in Excel
Fix the error of not being able to use the F4 key in Excel with shortcut keys
9 Ways to Fix Keyboard Typing Delay on Windows 10/11
Why should you replace your iPhone's default keyboard with Gboard?
It's time to switch to Passkey: The anti-phishing password alternative!