To view or modify the serial number of a Windows family system Vbs_vbs

Source: Internet
Author: User
'/*=========================================================================
' * Intro view or modify the serial number of the Windows family system (including: 2000,xp,2003), support the command line "Getchangewindowssn.vbs Windows system serial number", or run the input Windows system serial number directly.
' * 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) & "Please enter a 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 number of Windows serial numbers 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 replaced successfully. "
Else
WScript.Echo "Windows serial number replacement failed! 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 = &AMP;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 = 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--------------------------& Gt
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 = 0 Step-1
K = 0
For j = 0 Step-1
K = k * 256 Xor Arrdpid (j)
Arrdpid (j) = Int (K/24)
K = k Mod 24
Next
Strproductkey = Arrchars (k) & Strproductkey
' <-------add '-"between the groups of 5 Char-------->
If I Mod 5 = 0 and I <> 0 Then strproductkey = "-" & Strproductkey
Next
GETWINDOWSSN = Strproductkey
End Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.