Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Windows XP 更改產品序列號完整教學:圖形介面與腳本雙管齊下

編輯:XP 系統基礎知識

當您需要更換已安裝完成的 Windows XP 產品金鑰時,主要有兩種途徑:一是透過內建的啟動精靈(GUI 介面)操作,二是利用 WMI(Windows Management Instrumentation)腳本自動化完成。本文將詳細說明這兩種方法的具體步驟,並提供針對 SP1 及非 SP1 環境的現成 VBS 腳本,方便不同需求的使用者套用。

方法一:使用啟動精靈手動修改

微軟建議在修改前先建立一個系統還原點,以防操作失誤導致系統異常。

  1. 點擊「開始」→「執行」,輸入 regedit 開啟登錄編輯器。
  2. 定位至 HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\WPAEvents,在右側找到 OOBETimer,右鍵選擇「修改」。
  3. 至少更改一個位元組的數值,按確定儲存。
  4. 再次開啟「執行」,輸入 %systemroot%\system32\oobe\msoobe.exe /a 啟動啟動精靈。
  5. 選擇「透過電話啟動」→「下一步」→「變更產品金鑰」。
  6. 輸入新的 25 字元序列號,點擊「更新」。
  7. 若返回上一畫面,請選「稍後啟動」並重新開機。
  8. 重複第 4–6 步驟直到顯示啟動成功。
  9. 完成後建議安裝 Service Pack 1(SP1)以確保系統穩定;若安裝 SP1 後無法開機,請進入「最後一次正確配置」模式並重新執行上述流程。

方法二:使用 WMI 腳本自動化修改

下方提供兩支 VBS 腳本,分別適用於「已安裝 SP1」與「未安裝 SP1」的 Windows XP 環境。使用方式相同:將腳本儲存為 .vbs 檔,於命令提示字元以 cscript 執行並帶入新金鑰參數。

適用於已安裝 SP1 的系統(ChangeVLKeySp1.vbs)

' WMI Script - ChangeVLKeySp1.vbs
' Windows XP With SP1
' This script changes the product key on the computer
'***************************************************************************
ON ERROR RESUME NEXT
if Wscript.arguments.count < 1 then
  Wscript.echo "Script can't run without VolumeProductKey argument"
  Wscript.echo "Correct usage: Cscript ChangeVLKeySp1.vbs ABCDE-FGHIJ-KLMNO-PRSTU-WYQZX"
  Wscript.quit
end if
Dim VOL_PROD_KEY
VOL_PROD_KEY = Wscript.arguments.Item(0)
VOL_PROD_KEY = Replace(VOL_PROD_KEY,"-","") 'remove hyphens if any
for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation")
  result = Obj.SetProductKey (VOL_PROD_KEY)
  if err <> 0 then
    WScript.Echo Err.Description, "0x" & Hex(Err.Number)
    Err.Clear
  end if
Next

適用於未安裝 SP1 的系統(ChangeVLKey2600.vbs)

' WMI Script - ChangeVLKey2600.vbs
' Windows XP Without SP1
' This script changes the product key on the computer
'***************************************************************************
ON ERROR RESUME NEXT
if Wscript.arguments.count < 1 then
  Wscript.echo "Script can't run without VolumeProductKey argument"
  Wscript.echo "Correct usage: Cscript ChangeVLKey2600.vbs ABCDE-FGHIJ-KLMNO-PRSTU-WYQZX"
  Wscript.quit
end if
Dim VOL_PROD_KEY
VOL_PROD_KEY = Wscript.arguments.Item(0)
VOL_PROD_KEY = Replace(VOL_PROD_KEY,"-","") 'remove hyphens if any
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WPAEvents\OOBETimer" 'delete OOBETimer registry value
for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation")
  result = Obj.SetProductKey (VOL_PROD_KEY)
  if err <> 0 then
    WScript.Echo Err.Description, "0x" & Hex(Err.Number)
    Err.Clear
  end if
Next

腳本執行範例

  1. 將對應版本的 .vbs 檔放至 C 槽根目錄(或任意資料夾)。
  2. 點擊「開始」→「執行」,輸入:
    C:\ChangeVLKeySp1.vbs ABCDE-FGHIJ-KLMNO-PRSTU-WYQZX
    (將範例金鑰替換為您的新序列號)。
  3. 按確定執行,腳本將自動完成金鑰變更與啟動流程。

提醒:請務必使用合法授權的產品金鑰,並確認腳本版本與系統 Service Pack 狀態相符,以免造成啟動失敗。

Copyright © Windows教程網 All Rights Reserved