'/* =================================================== ==========================================
'* Intro views or modifies the serial numbers of Windows systems (including 2000, XP, and 2003), supports the command line "getchangewindowssn. vbs Windows system serial number", or directly runs and enters the Windows system serial number.
'* Filename getchangewindowssn. vbs
'* Author yongfa365
'* Version V1.0
'* Email yongfa365 [at] QQ.com
'* Madetime 2007-10-13 21:40:09
'* Lastmodify 2007-10-13 21:40:09
'* ===================================================== ============================================= */
On Error resume next
Sn_xp_1 = "MRX3F-47B9T-2487J-KWKMF-RPWBY" 'Good
Sn_xp_2 = "QC986-27D34-6M3TY-JJXP9-TBGMD"
Sn_xp_3 = "K2CXT-C6TPX-WCXDP-RMHWT-V4TDT"
Sn_xp_4 = "22dvc-gwqw7-7g228-d72y7-qk8q3"
Sn_xp_5 = "DG8FV-B9TKY-FRT9J-6CRCC-XPQ4G"
Sn_xp_6 = "T44H2-BM3G7-J4CQR-MPDRM-BWFWM"
Sn_xp_7 = "XW6Q2-MP4HK-GXFK3-KPGG4-GM36T"
Sn_2000_1 = "PQHKR-G4JFW-VTY3P-G4WQ2-88CTW"
Sn_2000_server_1 = "H6TWQ-TQQM8-HXJYG-D69F7-R84VM"
Sn_2000_advanced_server_1 = "H6TWQ-TQQM8-HXJYG-D69F7-R84VM"
Sn_2003_1 = "JCGMJ-TC669-KCBG7-HB8X2-FXG7M" 'Good
Sn_2003_2 = "DF74D-TWR86-D3F4V-M8D8J-WTT7M" 'Good
Sn_2003_2 = "KQF2H-284RW-GHXM6-Y3W2B-QWGBB"
Dim vol_prod_key
If wscript. Arguments. Count <1 then
Vol_prod_key = inputbox ("your current Windows system serial number is:" & getwindowssn & string (5, vbcrlf) & "Enter the new Windows serial number :", "Windows serial number changer", sn_2003_1)
If vol_prod_key = "" or Len (vol_prod_key) <> 29 then
Wscript. Echo "you have chosen to cancel or the Windows serial number is empty or the Windows serial number is incorrect. -- exit"
Wscript. Quit
End if
Else
Vol_prod_key = wscript. Arguments. Item (0)
End if
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 "Windows serial number is replaced successfully. "
Else
Failed to replace wscript. Echo "Windows serial number! The serial number you entered is incorrect. "
Err. Clear
End if
Next
'Get the current Windows serial number Function
Function getwindowssn ()
Const HKEY_LOCAL_MACHINE = & h80000002
Strkeypath = "SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion"
Strvaluename = "digitalproductid"
Strcomputer = "."
Dim ivalues ()
Set oreg = GetObject ("winmgmts: {impersonationlevel = impersonate }! \ "& Strcomputer &" \ Root \ default: stdregprov ")
Oreg. getbinaryvalue HKEY_LOCAL_MACHINE, strkeypath, strvaluename, ivalues
Dim arrdpid
Arrdpid = array ()
For I = 52 to 66
Redim preserve arrdpid (ubound (arrdpid) + 1)
Arrdpid (ubound (arrdpid) = ivalues (I)
Next
'<------------- Create an array to hold the valid characters for a Microsoft Product Key -------------------------->
Dim arrchars
Arrchars = array ("B", "C", "D", "F", "g", "H", "J", "k", "M ", "P", "Q", "r", "T", "V", "W", "X", "Y", "2", "3 ", "4", "6", "7", "8", "9 ")
'<------------- The clever bit !!! (Decrypt the base24 encoded binary data) ------------------------>
For I = 24 to 0 step-1
K = 0
For J = 14 to 0 step-1
K = K * 256 XOR arrdpid (j)
Arrdpid (j) = int (K/24)
K = K mod 24
Next
Strproductkey = arrchars (k) & strproductkey
'<------- Add the "-" between the groups of 5 char -------->
If I mod 5 = 0 and I <> 0 then strproductkey = "-" & strproductkey
Next
Getwindowssn = strproductkey
End Function