VBS scripts perform different versions of Windows OS activation tasks (mak&kms activation)

Source: Internet
Author: User
Tags skms

Tag: VBS script performs different versions of Windows OS Activation task (mak&kms activation)

Vbs scripts that perform different versions of the Windows OS Activating Tasks (mak&kms active )


We introduced the VBS script to accomplish some semi-automatic tasks, and today we introduce a VBS script that performs different versions of the Windows OS Activation task (mak&kms activation), in fact, regardless of what functionality is implemented through VBS, We still need to clear the idea to complete the relevant logic program writing and operation. Now that we're going to use the VBS script to do different versions of the activation task, and different versions of the OS have different MAK keys, we need to get the system version to complete the OS activation task. Similarly, we need to define the activation program for the user, only the specified MAC address to complete the activation task, so we have two logical thinking, 1. Gets the user's MAC address. 2 Gets the system version of the user (Windows7, windows8, WINDOWS10, WINDOWS2008R2, windows2012r2 ...). 3 through the user different version of the OS to complete the corresponding OS key import and activation. specifically see below:

The first is to get the user's MAC address

650) this.width=650; "title=" clip_image002 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image002" src= "http://s3.51cto.com/wyfs02/M00/72/CF/wKiom1XtgIKynLLhAACQl7QLzRk090.jpg" height= "209"/>

Set MC = GetObject ("winmgmts:"). InstancesOf ("Win32_NetworkAdapterConfiguration") for each mo in mcIf mo. ipenabled = True Then ' Traceprint ' the native Nic MAC address is: ' & mo. Macaddressgetmac = mo. Macaddressexit forend Ifnextmsgbox Getmac

650) this.width=650; "title=" clip_image004 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image004" src= "http://s3.51cto.com/wyfs02/M01/72/CF/wKiom1XtgILx-Y1UAACzBopz68c365.jpg" height= "279"/>

Then we need to get the OS version of the system;

Because there are many versions of the current system (Windows7, Windows8, Windows10, windows2008r2, windows2012r2 ...), we need to get the system version;

650) this.width=650; "title=" clip_image006 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image006" src= "http://s3.51cto.com/wyfs02/M02/72/CB/wKioL1XtgqvAwmu8AACDJsfCH38093.jpg" height= "/>"

StrComputer = "." Set objWMIService = GetObject ("winmgmts:\\" & StrComputer & "\root\cimv2") Set colitems = objWMIService.ExecQuery ("SELECT * from Win32_OperatingSystem") For each objitem in colitemsstrosversion = Objitem.versionosversion = Objitem.captionnextgetosversion=osversionmsgbox Getosversion

650) this.width=650; "title=" clip_image007 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px, "border=" 0 "alt=" clip_ image007 "src=" http://s3.51cto.com/wyfs02/M00/72/CB/wKioL1XtgqyxtlZ_AAEl_QOZG6E205.jpg "height=" 310 "/>

After satisfying the above conditions, we can embed the code, we need to define two functions, one is: Get the user system version, the other is to get the user's MAC address. And then judge the execution by condition.

We define the key that is specified when obtaining the user version of the Windows7 Enterprise version or Professional version of the import, and then complete the activation. Then get the specified key for WINDOWS10 enterprise or Pro, then complete activation.

If getmac ()  <>  "44:37-e6:20-f8:03"  thenset wshell=createobject ("Wscript.Shell") CreateObject ("Wscript.Shell"). popup  "please wait for activing&nbsp ...", 3,  "MsgBox", 64msgbox  "Mac  address: " & getmac () &NBSP;&AMP;&NBSP;CHR ()  & " OSVersion: " &  Getosversion () &NBSP;&AMP;&NBSP;CHR () if getosversion ()  =  "microsoft winodws 7  Enterprise Edition " or getosversion ()  = " microsoft winodws 7  Professional Edition " thenwshell.run   "slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx",0,truewshell.run  "Slmgr.vbs /ato", 0, Trueelseif getosversion ()  =  "microsoft windows 10  Enterprise Edition"  or getosversion ()  =  "microsoft windows 10  Pro"  ThenWshell.Run  "slmgr.vbs /ipk  Xxxxx-xxxxx-xxxxx-xxxxx-xxxxx ",0,truewshell.run " Slmgr.vbs /ato ", 0,trueelseif getosveRsion ()  =  "Microsoft windows server 2012 r2 datacenter"  Or  Getosversion ()  =  "Microsoft windows server 2012 r2 standard"   thenwshell.run  "slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx",0,truewshell.run  "slmgr.vbs  /ato ", 0,trueelseif getosversion ()  = " microsoft windows 10  Enterprise Edition "  thenwshell.run  "slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx",0,truewshell.run  "slmgr.vbs  /ato ",0,trueend ifmsgbox " active success "elsemsgbox " Active Failed "End  Iffunction getmac () getmac =  "" Dim mc,moset mc = getobject ("Winmgmts:"). InstancesOf ("Win32_NetworkAdapterConfiguration") For each mo in mcif mo. Ipenabled = true then ' traceprint  "native Nic mac address is: "  & mo. Macaddressgetmac = mo. Macaddressexit forend ifnextseT mc = nothingend functionfunction getosversion () strcomputer =  "." Set objwmiservice = getobject ("winmgmts:\\"  & strComputer &  "\root\ Cimv2 ") set colitems = objwmiservice.execquery (" Select * from win32_ OperatingSystem ") for each objitem in colitemsstrosversion =  Objitem.versionosversion = objitem.captionnextgetosversion=osversionend function

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/CF/wKiom1XtgrngRwRZAAHBzhPdsqA571.jpg "style=" float: none; "title=" 1.png "alt=" Wkiom1xtgrngrwrzaahbzhpdsqa571.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/CC/wKioL1XthOOQKYqTAAGkc90CbUU557.jpg "style=" float: none; "title=" 2.png "alt=" Wkiol1xthooqkyqtaagkc90cbuu557.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/CF/wKiom1Xtgrmx5_GTAAHKPIT-yj8009.jpg "style=" float: none; "title=" 3.png "alt=" Wkiom1xtgrmx5_gtaahkpit-yj8009.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/CC/wKioL1XthOORt4UkAAGx4VYkvck280.jpg "style=" float: none; "title=" 4.png "alt=" Wkiol1xthoort4ukaagx4vykvck280.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/CF/wKiom1XtgrqD7dJnAAJmKZbFO9c128.jpg "style=" float: none; "title=" 6.png "alt=" Wkiom1xtgrqd7djnaajmkzbfo9c128.jpg "/>

After we have completed MAK activation, if we define the use of KMS activation, actually using KMS activation is simple, we only need to change the original code from import IPK to skms activation. Because we all know that the command to use KMS activation is:

The ' KMS activation command is as follows: ' slmgr.vbs /skms kmshosts.abc.com:1688 ' Slmgr.vbs /ato so the modified code is: see below: If getmac ()  <>  "44:37-e6:20-f8:03"  thenset wshell=createobject ("Wscript.Shell") CreateObject (" Wscript.Shell "). popup  "please wait for activing&nbsp ...", 3,  "MsgBox",  64 ' msgbox  "Mac  address: " & getmac () &NBSP;&AMP;&NBSP;CHR ()  & " OSVersion: " &  Getosversion () &NBSP;&AMP;&NBSP;CHR () if getosversion ()  =  "microsoft winodws 7  Enterprise Edition " or getosversion ()  = " microsoft winodws 7  Professional Edition " thenwshell.run   "slmgr.vbs /skms bj-actsrv02.beyondsoft.com",0,truewshell.run  "Slmgr.vbs /ato", 0, Trueelseif getosversion ()  =  "microsoft windows 10  Enterprise Edition"  or getosversion ()  =  "microsoft windows 10  Pro"  ThenWshell.Run  "slmgr.vbs /skms  Bj-actsrV02.beyondsoft.com ",0,truemsgbox " Slmgr.vbs /ato "wshell.run " Slmgr.vbs /ato ", 0,trueelseif  getosversion ()  =  "microsoft windows 8.1  Pro"  thenWshell.Run  " slmgr.vbs /skms bj-actsrv02.beyondsoft.com:1688 ",0,truewshell.run " Slmgr.vbs /ato ", 0, Trueelseif getosversion ()  =  "microsoft windows server 2012 r2  Datacenter " or getosversion ()  = " Microsoft windows server 2012 r2  standard " thenWshell.Run " slmgr.vbs /skms bj-actsrv02.beyondsoft.com ", 0, truewshell.run  "Slmgr.vbs /ato",0,trueend ifmsgbox  "active success" Elsemsgbox  " Active failed "End iffunction getmac () getmac = " "dim mc,moset mc =  getobject ("winmgmts:"). InstancesOf ("Win32_NetworkAdapterConfiguration") For each mo in mcif mo. Ipenabled = true then ' Traceprint  "native Nic mac address is: "  & mo. Macaddressgetmac = mo. macaddressexit forend ifnextset mc = nothingend functionfunction  Getosversion () strcomputer =  "." Set objwmiservice = getobject ("winmgmts:\\"  & strComputer &  "\root\ Cimv2 ") set colitems = objwmiservice.execquery (" Select * from win32_ OperatingSystem ") for each objitem in colitemsstrosversion =  Objitem.versionosversion = objitem.captionnextgetosversion=osversionend function

Once defined, we can also use the access described in the previous article, and then encapsulate the VBS script with the tool into EXE, which improves security

This article from "Gao Wenrong" blog, declined reprint!

VBS scripts perform different versions of Windows OS activation tasks (mak&kms activation)

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.