Board logo

标题: [转贴] 查看或修改Windows系列系统的序列号 [打印本页]

作者: youxi01    时间: 2007-12-30 23:25     标题: 查看或修改Windows系列系统的序列号

  1. '/*=========================================================================
  2. ' * Intro       查看或修改Windows系列系统的序列号(包括:2000,xp,2003),支持命令行“GetChangeWindowsSN.vbs Windows系统序列号” 或 直接运行输入Windows系统序列号。
  3. ' * FileName    GetChangeWindowsSN.vbs
  4. ' * Author      yongfa365
  5. ' * Version     v1.0
  6. ' * Email       yongfa365[at]qq.com
  7. ' * MadeTime    2007-10-13 21:40:09
  8. ' * LastModify  2007-10-13 21:40:09
  9. ' *==========================================================================*/
  10. On Error Resume Next
  11. SN_XP_1 = "MRX3F-47B9T-2487J-KWKMF-RPWBY" 'good
  12. SN_XP_2 = "QC986-27D34-6M3TY-JJXP9-TBGMD"
  13. SN_XP_3 = "K2CXT-C6TPX-WCXDP-RMHWT-V4TDT"
  14. SN_XP_4 = "22DVC-GWQW7-7G228-D72Y7-QK8Q3"
  15. SN_XP_5 = "DG8FV-B9TKY-FRT9J-6CRCC-XPQ4G"
  16. SN_XP_6 = "T44H2-BM3G7-J4CQR-MPDRM-BWFWM"
  17. SN_XP_7 = "XW6Q2-MP4HK-GXFK3-KPGG4-GM36T"
  18. SN_2000_1 = "PQHKR-G4JFW-VTY3P-G4WQ2-88CTW"
  19. SN_2000_Server_1 = "H6TWQ-TQQM8-HXJYG-D69F7-R84VM"
  20. SN_2000_Advanced_Server_1 = "H6TWQ-TQQM8-HXJYG-D69F7-R84VM"
  21. SN_2003_1 = "JCGMJ-TC669-KCBG7-HB8X2-FXG7M" 'good
  22. SN_2003_2 = "DF74D-TWR86-D3F4V-M8D8J-WTT7M" 'good
  23. SN_2003_2 = "KQF2H-284RW-GHXM6-Y3W2B-QWGBB"
  24. Dim VOL_PROD_KEY
  25. If WScript.arguments.Count<1 Then
  26.     VOL_PROD_KEY = InputBox("您当前的Windows系统序列号为:" & GetWindowsSN & String(5, vbCrLf) & "请输入新的Windows序列号:", "Windows序列号更换器", SN_2003_1)
  27.     If VOL_PROD_KEY = "" Or Len(VOL_PROD_KEY)<>29 Then
  28.         WScript.echo "您选择了取消 或 Windows序列号为空 或 Windows序列号位数有误  ——》退出"
  29.         WScript.Quit
  30.     End If
  31. Else
  32.     VOL_PROD_KEY = WScript.arguments.Item(0)
  33. End If
  34. VOL_PROD_KEY = Replace(VOL_PROD_KEY, "-", "") 'remove hyphens if any
  35. For Each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation")
  36.     result = Obj.SetProductKey (VOL_PROD_KEY)
  37.     If Err = 0 Then
  38.         WScript.echo "Windows序列号替换成功。"
  39.     Else
  40.         WScript.echo "Windows序列号替换失败!您输入的序列号有误。"
  41.         Err.Clear
  42.     End If
  43. Next
  44. '取得当前Windows序列号函数
  45. Function GetWindowsSN()
  46.     Const HKEY_LOCAL_MACHINE = &H80000002
  47.     strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
  48.     strValueName = "DigitalProductId"
  49.     strComputer = "."
  50.     Dim iValues()
  51.     Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
  52.     oReg.GetBinaryValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, iValues
  53.     Dim arrDPID
  54.     arrDPID = Array()
  55.     For i = 52 To 66
  56.         ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
  57.         arrDPID( UBound(arrDPID) ) = iValues(i)
  58.     Next
  59.     ' <--------------- Create an array to hold the valid characters for a microsoft Product Key -------------------------->
  60.     Dim arrChars
  61.     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")
  62.     ' <--------------- The clever bit !!! (Decrypt the base24 encoded binary data)-------------------------->
  63.     For i = 24 To 0 Step -1
  64.         k = 0
  65.         For j = 14 To 0 Step -1
  66.             k = k * 256 Xor arrDPID(j)
  67.             arrDPID(j) = Int(k / 24)
  68.             k = k Mod 24
  69.         Next
  70.         strProductKey = arrChars(k) & strProductKey
  71.         ' <------- add the "-" between the groups of 5 Char -------->
  72.         If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey
  73.     Next
  74.     GetWindowsSN = strProductKey
  75. End Function
复制代码

作者: 葱头    时间: 2008-4-22 20:45

这有什么用?????修改Windows系列系统的序列号有什么用处
还是这用来练手????????

查看还可以~~~~~~




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2