Activation Windows
Activation Windows
Activation Windows
-- ::
@echo off
::=================================================================================
=======================================================
: Credits:
:
===================================================================================
========================================
: *Anonymous and @mspaintmsi - Original (co)Authors of HWID and KMS38 Activation
without KMS or predecessor install/upgrade
: - Created various methods for HWID and KMS38
Activation
: https://www.nsaneforums.com/topic/316668--/?
do=findComment&comment=1497887
:
===================================================================================
========================================
: This script is a part of 'Microsoft Activation Scripts'
: Maintained by @WindowsAddict
: Homepage - https://www.nsaneforums.com/topic/316668--/
::=================================================================================
=======================================================
::=================================================================================
=======================================================
cls
title KMS38 Activation
if /i "%*" EQU "/u" (set Unattended=1) else (set Unattended=0)
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" >
NUL && set arch=x86|| set arch=x64
set "nul=>nul 2>&1"
set "ELine=echo. &call :Color 4F "==== ERROR ====" &echo:&echo."
setlocal EnableDelayedExpansion
call :Color_Pre
::=================================================================================
=======================================================
: ===========================================================
: Check if the file path name contains special characters
: https://stackoverflow.com/a/33626625
: Written by @jeb (stackoverflow)
: Thanks to @abbodi1406 (MDL) for the help.
: ===========================================================
setlocal
setlocal DisableDelayedExpansion
set "param=%~f0"
cmd /v:on /c echo(^^!param^^!| findstr /R "[| ` ~ ! @ %% \^ & ( ) \[ \] { } + = ; '
, |]*^"
endlocal
if %errorlevel% EQU 0 (
%ELine%
echo Disallowed special characters detected in file path name.
echo Make sure file path name do not have following special characters,
echo ^` ^~ ^! ^@ %% ^^ ^& ^( ^) [ ] { } ^+ ^= ^; ^' ^,
goto Done
)
::=================================================================================
=======================================================
::=================================================================================
=======================================================
: ==========================================================
: self-elevate passing args and preventing loop
: using wsf - needs the 1st and the last 2 lines in place)
: Written by @AveYo aka @BAU
: ==========================================================
:ElevationError
%ELine%
echo Right click on this file and select 'Run as administrator'
goto Done
:GotPrivileges
::=================================================================================
=======================================================
::=================================================================================
=======================================================
::=================================================================================
=======================================================
cls
if "%osedition%"=="" (
%ELine%
echo OS Edition was not detected properly. Aborting...
goto Done
)
::=================================================================================
=======================================================
call :CheckPermAct
if [!Perm!]==[1] (
echo ----------------------------------------------
echo Checking: Windows is Permanently Activated.
echo Activation is not required.
echo ----------------------------------------------
echo.
if %Unattended% EQU 1 goto Done
echo ----------------------------------------
echo Press [A] or [B] button in Keyboard :
echo ----------------------------------------
echo.
choice /C:AB /N /M "[A] I still want to Activate [B] Exit : "
if errorlevel 2 exit /b
if errorlevel 1 goto continue
)
::=================================================================================
=======================================================
:Continue
cls
set key=
call :%osedition% %nul%
if "%Key%"=="" (
%ELine%
echo [%osedition% ^| %winbuild%] KMS38 Activation is Not Supported.
goto Done
)
if defined A_Cor (
call :check clipup.exe
if defined _miss goto Done
)
::=================================================================================
=======================================================
cd /d "%~dp0"
if exist "%~dp0Files\*.xml" del /f /q "%~dp0Files\*.xml"
if exist "%~dp0Files\gatherosstatemodified.exe" del /f /q
"%~dp0Files\gatherosstatemodified.exe"
cls
echo.
if defined Clst_e (sc config %_1% start= Demand %nul% && set Clst_s=%_1%-
Demand || set Clst_u=%_1%-Demand )
if defined spst_e (sc config %_3% start= Delayed-Auto %nul% && set spst_s=%_3%-
Delayed-Auto || set spst_u=%_3%-Delayed-Auto )
echo.
cscript /nologo %windir%\system32\slmgr.vbs -ipk %key%
: ======================================
: Set specific KMS host to Local Host
: Written by @abbodi1406 (MDL)
: ======================================
call "%~dp0Files\gatherosstate.exe"
echo.
set "Act=Activation "
cscript /nologo %windir%\system32\slmgr.vbs -ato %nul%
call :CheckEXPtime
if %gpr% GTR 259200 (
call :Actinfo
goto Done
)
: ====================================================================
: Clear 180 Days KMS Activation lock without full Rearm and Restart
: Concept taken from the @Ratiborus Tools
: http://forum.ru-board.com/topic.cgi?forum=2&topic=5734#1
: ====================================================================
if defined RearmF (
call :Color 4F "%Rearm% [Unsuccessful]" &echo:
) else (
echo %Rearm% [Successful]
)
echo.
call :CheckEXPtime
if %gpr% GTR 259200 (
call :Actinfo
goto Done
)
call :ActivationRetry
call :CheckEXPtime
if %gpr% GTR 259200 (
call :Actinfo
goto Done
)
goto Done
::=================================================================================
=======================================================
: ================================
: Echo all the missing files.
: Written by @abbodi1406 (MDL)
: ================================
:check
for %%# in (%1 %2) do (if not exist "%~dp0Files\%%#" (if defined _miss (set
"_miss=!_miss! %%#") else (set "_miss=%%#")))
if defined _miss (
%ELine%
echo Following required file^(s^) is missing in 'Files' folder. Aborting...
echo.
echo !_miss!
)
exit /b
::=================================================================================
=======================================================
:ServiceCheck
: ======================================
: Detect Service status and start type
: Written by @RPO (MDL)
: ======================================
for /f "tokens=1,3 delims=: " %%a in ('sc query %1') do (if /i %%a==state set
"state=%%b")
for /f "tokens=1-4 delims=: " %%a in ('sc qc %1') do (if /i %%a==start_type set
"start_type=%%c %%d")
::=================================================================================
=======================================================
:CheckPermAct
: ===========================================
: Check Windows Permanent Activation status
: Written by @abbodi1406 (MDL)
: ===========================================
::=================================================================================
=======================================================
:ActivationRetry
: ======================================
: Detect Error Code in the Activation
: Written by @abbodi1406 (MDL)
: ======================================
::=================================================================================
=======================================================
:Actinfo
call :Color 2F "%Act% [Successful]" &echo:
cscript /nologo %windir%\system32\slmgr.vbs -xpr
exit /b
::=================================================================================
=======================================================
:CheckEXPtime
: ======================================
: Check Activation remaining time
: Written by @abbodi1406 (MDL)
: ======================================
::=================================================================================
=======================================================
: ======================================================
: Multicolor outputs without any external programs
: https://stackoverflow.com/a/5344911
: Written by @jeb (stackoverflow)
: ======================================================
:Color_Pre
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do
rem"') do (set "DEL=%%a") &exit /b
:color
pushd "%temp%"
<nul set /p ".=%DEL%" > "%~2" &findstr /v /a:%1 /R "^$" "%~2" nul &del "%~2" > nul
2>&1 &popd &exit /b
::=================================================================================
=======================================================
:Done
echo.
if %Unattended% EQU 1 (
echo Exiting in 5 seconds...
if %winbuild% LSS 7600 (ping -n 5 127.0.0.1 > nul) else (timeout /t 5)
exit /b
)
echo Press any key to exit...
pause >nul
exit /b
::=================================================================================
=======================================================
:Core
set "key=TX9XD-98N7V-6WMQ6-BX7FG-H8Q99"
exit /b
:CoreCountrySpecific
set "key=PVMJN-6DFY6-9CCP6-7BKTT-D3WVR"
exit /b
:CoreN
set "key=3KHY7-WNT83-DGQKR-F7HPR-844BM"
exit /b
:CoreSingleLanguage
set "key=7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH"
exit /b
:Education
set "key=NW6C2-QMPVW-D7KKK-3GKT6-VCFB2"
exit /b
:EducationN
set "key=2WH4N-8QGBV-H22JP-CT43Q-MDWWJ"
exit /b
:Enterprise
set "key=NPPR9-FWDCX-D2C8J-H872K-2YT43"
exit /b
:EnterpriseG
set "key=YYVX9-NTFWV-6MDM3-9PT4T-4M68B"
exit /b
:EnterpriseGN
set "key=44RPN-FTY23-9VTTB-MP9BX-T84FV"
exit /b
:EnterpriseN
set "key=DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4"
exit /b
:EnterpriseS
if "%winbuild%" EQU "14393" set "key=DCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ"
if "%winbuild%" EQU "17763" set "key=M7XTQ-FN8P6-TTKYV-9D4CC-J462D"
exit /b
:EnterpriseSN
if "%winbuild%" EQU "14393" set "key=QFFDN-GRT3P-VKWWX-X7T3R-8B639"
if "%winbuild%" EQU "17763" set "key=92NFX-8DJQP-P6BBQ-THF9C-7CG2H"
exit /b
:Professional
set "key=W269N-WFGWX-YVC9B-4J6C9-T83GX"
exit /b
:ProfessionalEducation
set "key=6TP4R-GNPTD-KYYHQ-7B7DP-J447Y"
exit /b
:ProfessionalEducationN
set "key=YVWGF-BXNMC-HTQYQ-CPQ99-66QFC"
exit /b
:ProfessionalN
set "key=MH37W-N47XK-V7XM9-C7227-GCQG9"
exit /b
:ProfessionalWorkstation
set "key=NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J"
exit /b
:ProfessionalWorkstationN
set "key=9FNHH-K3HBT-3W4TD-6383H-6XYWF"
exit /b
:ServerCloudStorage
if "%winbuild%" EQU "14393" set "key=QN4C6-GBJD2-FB422-GHWJK-GJG2R"
exit /b
:ServerDatacenter
if "%winbuild%" EQU "14393" set "key=CB7KF-BWN84-R7R2Y-793K2-8XDDG"
if "%winbuild%" EQU "17763" set "key=WMDGN-G9PQG-XVVXX-R3X43-63DFG"
exit /b
:ServerDatacenterACor
if "%winbuild%" EQU "16299" set "key=6Y6KB-N82V8-D8CQV-23MJW-BWTG6"
if "%winbuild%" EQU "17134" set "key=2HXDN-KRXHB-GPYC7-YCKFJ-7FVDG"
if "%winbuild%" EQU "17763" set "key=6NMRW-2C8FM-D24W7-TQWMY-CWH2D"
if "%winbuild%" GEQ "18362" set "key=TX3M3-HN6CW-2D8RM-QKCVK-WT3F3"
exit /b
:ServerDatacenterCor
if "%winbuild%" EQU "14393" set "key=CB7KF-BWN84-R7R2Y-793K2-8XDDG"
if "%winbuild%" EQU "17763" set "key=WMDGN-G9PQG-XVVXX-R3X43-63DFG"
exit /b
:ServerRdsh
if "%winbuild%" LSS "17763" set "key=7NBT4-WGBQX-MP4H7-QXFF8-YP3KX"
if "%winbuild%" GEQ "17763" set "key=CPWHC-NT2C7-VYW78-DHDB2-PG3GK"
exit /b
:ServerSolution
if "%winbuild%" EQU "14393" set "key=JCKRF-N37P4-C2D82-9YXRT-4M63B"
if "%winbuild%" EQU "17763" set "key=WVDHN-86M7X-466P6-VHXV7-YY726"
exit /b
:ServerSolutionCor
if "%winbuild%" EQU "14393" set "key=JCKRF-N37P4-C2D82-9YXRT-4M63B"
if "%winbuild%" EQU "17763" set "key=WVDHN-86M7X-466P6-VHXV7-YY726"
exit /b
:ServerStandard
if "%winbuild%" EQU "14393" set "key=WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY"
if "%winbuild%" EQU "17763" set "key=N69G4-B89J2-4G8F4-WWYCC-J464C"
exit /b
:ServerStandardACor
if "%winbuild%" EQU "16299" set "key=DPCNP-XQFKJ-BJF7R-FRC8D-GF6G4"
if "%winbuild%" EQU "17134" set "key=PTXN8-JFHJM-4WC78-MPCBR-9W4KR"
if "%winbuild%" EQU "17763" set "key=N2KJX-J94YW-TQVFB-DG9YT-724CC"
if "%winbuild%" GEQ "18362" set "key=PHN2T-WHKP4-X8RTQ-TD9TT-D3YPC"
exit /b
:ServerStandardCor
if "%winbuild%" EQU "14393" set "key=WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY"
if "%winbuild%" EQU "17763" set "key=N69G4-B89J2-4G8F4-WWYCC-J464C"
exit /b
::=================================================================================
=======================================================