快速业务通道

查看或修改Windows系列系统的序列号的vbs

作者 佚名 来源 ASP编程 浏览 发布时间 2013-07-09
''/*=========================================================================
''*Intro查看或修改Windows系列系统的序列号(包括:2000,xp,2003),支持命令行“GetChangeWindowsSN.vbsWindows系统序列号”或直接运行输入Windows系统序列号。
''*FileNameGetChangeWindowsSN.vbs
''*Authoryongfa365
''*Versionv1.0
''*Emailyongfa365[at]qq.com
''*MadeTime2007-10-1321:40:09
''*LastModify2007-10-1321:40:09
''*==========================================================================*/
OnErrorResumeNext
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"

DimVOL_PROD_KEY
IfWScript.arguments.Count<1Then
VOL_PROD_KEY=InputBox("您当前的Windows系统序列号为:"&GetWindowsSN&String(5,vbCrLf)&"请输入新的Windows序列号:","Windows序列号更换器",SN_2003_1)
IfVOL_PROD_KEY=""OrLen(VOL_PROD_KEY)<>29Then
WScript.echo"您选择了取消或Windows序列号为空或Windows序列号位数有误——》退出"
WScript.Quit
EndIf
Else
VOL_PROD_KEY=WScript.arguments.Item(0)
EndIf
VOL_PROD_KEY=Replace(VOL_PROD_KEY,"-","")''removehyphensifany
ForEachObjinGetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("win32_WindowsProductActivation")
result=Obj.SetProductKey(VOL_PROD_KEY)
IfErr=0Then
WScript.echo"Windows序列号替换成功。"
Else
WScript.echo"Windows序列号替换失败!您输入的序列号有误。"
Err.Clear
EndIf
Next

''取得当前Windows序列号函数
FunctionGetWindowsSN()
ConstHKEY_LOCAL_MACHINE=&H80000002
strKeyPath="SOFTWARE\Microsoft\WindowsNT\CurrentVersion"
strValueName="DigitalProductId"
strComputer="."
DimiValues()
SetoReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&strComputer&"\root\default:StdRegProv")
oReg.GetBinaryValueHKEY_LOCAL_MACHINE,strKeyPath,strValueName,iValues
DimarrDPID
arrDPID=Array()
Fori=52To66
ReDimPreservearrDPID(UBound(arrDPID)+1)
arrDPID(UBound(arrDPID))=iValues(i)
Next
''<---------------CreateanarraytoholdthevalidcharactersforamicrosoftProductKey-------------------------->
DimarrChars
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")
''<---------------Thecleverbit!!!(Decryptthebase24encodedbinarydata)-------------------------->
Fori=24To0Step-1
k=0
Forj=14To0Step-1
k=k*256XorarrDPID(j)
arrDPID(j)=Int(k/24)
k=kMod24
Next
strProductKey=arrChars(k)&strProductKey
''<-------addthe"-"betweenthegroupsof5Char-------->
IfiMod5=0Andi<>0ThenstrProductKey="-"&strProductKey
Next
GetWindowsSN=strProductKey
EndFunction

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号