因授權遷移、序號遺失或測試需求,有時必須在已安裝的 Windows XP 上更換產品金鑰。本文提供兩種官方支援的方法:啟動精靈法(GUI)與 WMI 腳本法(命令列),分別適用於有/無 SP1 的環境。
regedit 開啟登錄編輯器。HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\WPAEvents,右鍵修改 OOBETimer 值,任意更改一個位元組並存檔。%systemroot%\system32\oobe\msoobe.exe /a 啟動啟動精靈。微軟提供兩支 VBScript,分別針對 無 SP1 (ChangeVLKey2600.vbs) 與 已裝 SP1 (ChangeVLKeySp1.vbs)。核心邏輯皆呼叫 win32_WindowsProductActivation.SetProductKey 方法。
ON ERROR RESUME NEXT
if Wscript.arguments.count < 1 then
Wscript.echo "用法: Cscript ChangeVLKeySp1.vbs ABCDE-FGHIJ-KLMNO-PQRST-UVWXY"
Wscript.quit
end if
VOL_PROD_KEY = Replace(Wscript.arguments.Item(0), "-", "")
For Each Obj In GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("win32_WindowsProductActivation")
result = Obj.SetProductKey(VOL_PROD_KEY)
If Err.Number <> 0 Then WScript.Echo Err.Description, "0x" & Hex(Err.Number)
Next
額外在呼叫 SetProductKey 前,先刪除登錄值:
WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WPAEvents\OOBETimer"
C:\ 根目錄。C:\ChangeVLKeySp1.vbs AAAAA-BBBBB-CCCCC-DDDDD-EEEEE注意: 更換金鑰後必須重新啟動;若裝 SP1 後無法開機,請用 F8 進入「最後一次正確配置」再試。