查看或修改Windows系列系统的序列号的vbs
程序员文章站
2022-04-29 16:37:19
'/*========================================================================= ' *&...
'/*=========================================================================
' * 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
' * 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
上一篇: 网络
推荐阅读
-
Windows10系统下查看mysql的端口号并修改
-
Windows10系统下查看mysql的端口号并修改的教程图解
-
vbs Windows系统改变或修改网卡的MAC地址的脚本与软件
-
查看或修改Windows系列系统的序列号的vbs
-
如何修改Windows11系统的"国家或地区"?win11汉化步骤
-
vbs Windows系统改变或修改网卡的MAC地址的脚本与软件
-
vbs Windows系统改变或修改网卡的MAC地址的脚本与软件第1/2页
-
Windows10系统下查看mysql的端口号并修改
-
查看或修改Windows系列系统的序列号的vbs
-
Windows10系统下查看mysql的端口号并修改的教程图解