查看或修改Windows系列系统的序列号的vbs
'/*=========================================================================
' * Intro 查看或修改Windows系列系统的序列号(包括:2000,xp,2003),支持命令行“GetChangeWindowsSN.vbs Windows系统序列号” 或 直接运行输入Windows系统序列号。
' * 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("您当前的Windows系统序列号为:" & GetWindowsSN & String(5, vbCrLf) & "请输入新的Windows序列号:", "Windows序列号更换器", SN_2003_1)
If VOL_PROD_KEY = "" Or Len(VOL_PROD_KEY)<>29 Then
WScript.echo "您选择了取消 或 Windows序列号为空 或 Windows序列号位数有误 ——》退出"
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序列号替换成功。"
Else
WScript.echo "Windows序列号替换失败!您输入的序列号有误。"
Err.Clear
End If
Next
'取得当前Windows序列号函数
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
您可能感兴趣的文章
- 01-10VBS教程:属性-Name 属性
- 01-10VBS教程:属性-Item 属性
- 01-10利用vbscript脚本修改文件内容,此适用于自动化的操作中
- 01-10VBS常用脚本 好东西
- 01-10远程或本地获取系统信息的脚本RGIS.vbs
- 01-10利用vbs自动修改ip的代码
- 01-10VBS中常用脚本代码
- 01-10用VBS修改IIS Metabase 的代码
- 01-10用vbscript实现修改屏幕保护的等待时间长度
- 01-10用VBS修改IIS Metabase的代码
阅读排行
本栏相关
- 01-10下载文件到本地运行的vbs
- 01-10飘叶千夫指源代码,又称qq刷屏器
- 01-10SendKeys参考文档
- 01-10什么是一个高效的软件
- 01-10VBS中的正则表达式的用法大全 &l
- 01-10exe2swf 工具(Adodb.Stream版)
- 01-10VBS中SendKeys的基本应用
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript教程 第十一课深入VBScript
- 01-10VBScript语法速查及实例说明
随机阅读
- 01-10C#中split用法实例总结
- 01-10delphi制作wav文件的方法
- 08-05织梦dedecms什么时候用栏目交叉功能?
- 04-02jquery与jsp,用jquery
- 01-11ajax实现页面的局部加载
- 01-11Mac OSX 打开原生自带读写NTFS功能(图文
- 01-10SublimeText编译C开发环境设置
- 08-05DEDE织梦data目录下的sessions文件夹有什
- 01-10使用C语言求解扑克牌的顺子及n个骰子
- 08-05dedecms(织梦)副栏目数量限制代码修改