在 Windows 10、8 和 8.1 上備份產品金鑰的 2 種方法

在 Windows 10、8 和 8.1 上備份產品金鑰的 2 種方法

當您的Windows作業系統出現嚴重錯誤或崩潰等情況時,修復錯誤的解決方案通常是重新安裝作業系統。 Windows 使用者將必須使用產品金鑰來重新安裝作業系統。但是,要「購買」產品金鑰,您將需要支付一筆可觀的費用。

如果您不想支付任何費用,最好備份您的產品金鑰或啟動金鑰,以防出現問題。在下面的文章中,LuckyTemplates 將引導您完成在 Windows 10、8 和 Windows 8.1 上備份產品金鑰的 2 種方法。

另外,讀者可以在這裡參考文章《在 Windows 10 上更改產品金鑰的 5 種方法》

1. 在 Windows 10、8 和 Windows 8.1 上備份產品金鑰

請依照下列步驟在 Windows 10、8 和 Windows 8.1 上備份產品金鑰:

步驟1:

按Windows + R組合鍵開啟「執行」命令窗口,然後在「執行」命令視窗中輸入「notepad」並按Enter或按一下「確定」開啟新的記事本。

在 Windows 10、8 和 8.1 上備份產品金鑰的 2 種方法

第2步:

在新的記事本上,複製並貼上以下腳本:

#Main function
Function GetWin8Key
{
$Hklm = 2147483650
$Target = $env:COMPUTERNAME
$regPath = "Software\Microsoft\Windows NT\CurrentVersion"
$DigitalID = "DigitalProductId"
$wmi = [WMIClass]"\\$Target\root\default: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:Software\Microsoft\Windows NT\CurrentVersion" -Name "ProductName").ProductName
$ProductID = (Get-itemproperty -Path "HKLM:Software\Microsoft\Windows NT\CurrentVersion" -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 a file
$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"
do
{
$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

步驟3:

選擇儲存位置並為檔案指定任意名稱,並記住新增副檔名.ps1(刪除 .txt 副檔名)。

例如:

如果您想要將檔案命名為Windowsbackupproductkey ,請在檔案名稱」方塊中輸入全名Windowsbackupproductkey.ps1 。

在 Windows 10、8 和 8.1 上備份產品金鑰的 2 種方法

點擊“儲存”以儲存檔案。

步驟4:

右鍵單擊剛剛建立的文件,然後選擇“使用 PowerShell 運行”

在 Windows 10、8 和 8.1 上備份產品金鑰的 2 種方法

第5步:

PowerShell 會要求您確認是否要在電腦上儲存產品金鑰的副本。輸入Y,然後按 Enter 確認。

在 Windows 10、8 和 8.1 上備份產品金鑰的 2 種方法

第6步:

您在 Windows 10、8.1 和 8 上備份的產品金鑰將保存在電腦上的WindowsKeybackup.txt檔案中。

在 Windows 10、8 和 8.1 上備份產品金鑰的 2 種方法

2. 在 Windows 10、8.1 和 8 上備份產品金鑰的 PowerShell 腳本

除了上述方法外,您還可以在 Windows 10、8.1 和 8 上下載 PowerShell 腳本來備份產品金鑰。

在此處將 PowerShell 腳本下載到您的電腦

  1. 解壓縮您剛剛下載的 WindowsKeybackup.rar 檔案。
  2. 右鍵點選名為windowsbackupproductkey.ps1的文件,然後選擇使用 PowerShell 執行
  3. 在 PowerShell 視窗中輸入Y ,然後按 Enter。

現在您可以看到您在 Windows 10、8.1 和 8 電腦上備份的產品金鑰。

此外,您可以手動記錄您的Windows 10密鑰,然後當您完成電腦的安裝和修復後,只需再次輸入Windows密鑰即可。

更多的文章可以參考下面的文章:

祝你好運!


什麼是惡意軟體 HackTool:Win32/Keygen?如何去除?

什麼是惡意軟體 HackTool:Win32/Keygen?如何去除?

您是否掃描過您的設備並發現它感染了 HackTool:Win32/Keygen?在您使用破解或金鑰產生器啟動進階軟體後,Windows Defender 可能會自動警告您有關此惡意軟體的存在。

在 Windows 10 上建立備份和還原點(Restore Point)的說明

在 Windows 10 上建立備份和還原點(Restore Point)的說明

探索如何在Windows 10上建立和管理還原點,這是一項有效的系統保護功能,可以讓您快速還原系統至先前狀態。

在 Windows 10 中開啟裝置管理員的 15 種方法

在 Windows 10 中開啟裝置管理員的 15 種方法

您可以使用以下 15 種方法輕鬆在 Windows 10 中開啟<strong>裝置管理員</strong>,包括使用命令、捷徑和搜尋。

Windows「顯示桌面」的 10 種超快速方法

Windows「顯示桌面」的 10 種超快速方法

很多人不知道如何快速顯示桌面,只好將各個視窗一一最小化。這種方法對於用戶來說非常耗時且令人沮喪。因此,本文將向您介紹Windows中快速顯示桌面的十種超快速方法。

如何使用 Windows Repair 修復 Windows 錯誤

如何使用 Windows Repair 修復 Windows 錯誤

Windows Repair 是一款有效的 Windows 錯誤修復工具,幫助使用者修復與 Internet Explorer、Windows Update 和其他重要程式相關的錯誤。

如何在 Windows 10 中開啟資料夾選項或檔案總管選項

如何在 Windows 10 中開啟資料夾選項或檔案總管選項

您可以使用檔案總管選項來變更檔案和資料夾的工作方式並控制顯示。掌握如何在 Windows 10 中開啟資料夾選項的多種方法。

有關在 Windows 10 上刪除使用者帳戶的 5 種方法的說明

有關在 Windows 10 上刪除使用者帳戶的 5 種方法的說明

刪除不使用的使用者帳戶可以顯著釋放記憶體空間,並讓您的電腦運行得更流暢。了解如何刪除 Windows 10 使用者帳戶的最佳方法。

如何使用Bootsect /nt60將VBC更新為BOOTMGR

如何使用Bootsect /nt60將VBC更新為BOOTMGR

使用 bootsect 命令能夠輕鬆修復磁碟區引導程式碼錯誤,確保系統正常啟動,避免 hal.dll 錯誤及其他啟動問題。

Windows 11 中的存檔應用程式功能是什麼?應該啟用還是停用它?

Windows 11 中的存檔應用程式功能是什麼?應該啟用還是停用它?

存檔應用程式是一項功能,可以自動卸載您很少使用的應用程序,同時保留其關聯的檔案和設定。了解如何有效利用 Windows 11 中的存檔應用程式功能。

如何在 Windows 10 上為 BlueStacks 5 啟用虛擬化 (VT)

如何在 Windows 10 上為 BlueStacks 5 啟用虛擬化 (VT)

要啟用虛擬化,您必須先進入 BIOS 並從 BIOS 設定中啟用虛擬化,這將顯著提升在 BlueStacks 5 上的效能和遊戲體驗。