diff options
Diffstat (limited to 'MAS/All-In-One-Version-KL/MAS_AIO.cmd')
| -rw-r--r-- | MAS/All-In-One-Version-KL/MAS_AIO.cmd | 910 |
1 files changed, 124 insertions, 786 deletions
diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index c648563..0689192 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -391,7 +391,6 @@ set _elev= if defined _args echo "%_args%" | find /i "/S" %nul% && (set "_silent=%nul%") || (set _silent=)
if defined _args echo "%_args%" | find /i "/" %nul% && (
echo "%_args%" | find /i "/HWID" %nul% && (setlocal & cls & (call :HWIDActivation %_args% %_silent%) & endlocal)
-echo "%_args%" | find /i "/KMS38" %nul% && (setlocal & cls & (call :KMS38Activation %_args% %_silent%) & endlocal)
echo "%_args%" | find /i "/Z-" %nul% && (setlocal & cls & (call :TSforgeActivation %_args% %_silent%) & endlocal)
echo "%_args%" | find /i "/K-" %nul% && (setlocal & cls & (call :KMSActivation %_args% %_silent%) & endlocal)
echo "%_args%" | find /i "/Ohook" %nul% && (setlocal & cls & (call :OhookActivation %_args% %_silent%) & endlocal)
@@ -473,34 +472,32 @@ call :dk_color3 %_White% " [3] " %_Green% "TSforge" %_White% " ) else (
echo: [3] TSforge - Windows / Office / ESU
)
-echo: [4] KMS38 - Windows
-echo: [5] Online KMS - Windows / Office
+echo: [4] Online KMS - Windows / Office
echo: __________________________________________________
echo:
-echo: [6] Check Activation Status
-echo: [7] Change Windows Edition
-echo: [8] Change Office Edition
+echo: [5] Check Activation Status
+echo: [6] Change Windows Edition
+echo: [7] Change Office Edition
echo: __________________________________________________
echo:
-echo: [9] Troubleshoot
+echo: [8] Troubleshoot
echo: [E] Extras
echo: [H] Help
echo: [0] Exit
echo: ______________________________________________________________
echo:
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,3...E,H,0] :"
-choice /C:123456789EH0 /N
+choice /C:12345678EH0 /N
set _erl=%errorlevel%
-if %_erl%==12 exit /b
-if %_erl%==11 (start %selfgit% & start %github% & start %mas%troubleshoot & goto :MainMenu)
-if %_erl%==10 goto :Extras
-if %_erl%==9 setlocal & call :troubleshoot & cls & endlocal & goto :MainMenu
-if %_erl%==8 setlocal & call :change_offedition & cls & endlocal & goto :MainMenu
-if %_erl%==7 setlocal & call :change_winedition & cls & endlocal & goto :MainMenu
-if %_erl%==6 setlocal & call :check_actstatus & cls & endlocal & goto :MainMenu
-if %_erl%==5 setlocal & call :KMSActivation & cls & endlocal & goto :MainMenu
-if %_erl%==4 setlocal & call :KMS38Activation & cls & endlocal & goto :MainMenu
+if %_erl%==11 exit /b
+if %_erl%==10 (start %selfgit% & start %github% & start %mas%troubleshoot & goto :MainMenu)
+if %_erl%==9 goto :Extras
+if %_erl%==8 setlocal & call :troubleshoot & cls & endlocal & goto :MainMenu
+if %_erl%==7 setlocal & call :change_offedition & cls & endlocal & goto :MainMenu
+if %_erl%==6 setlocal & call :change_winedition & cls & endlocal & goto :MainMenu
+if %_erl%==5 setlocal & call :check_actstatus & cls & endlocal & goto :MainMenu
+if %_erl%==4 setlocal & call :KMSActivation & cls & endlocal & goto :MainMenu
if %_erl%==3 setlocal & call :TSforgeActivation & cls & endlocal & goto :MainMenu
if %_erl%==2 setlocal & call :OhookActivation & cls & endlocal & goto :MainMenu
if %_erl%==1 setlocal & call :HWIDActivation & cls & endlocal & goto :MainMenu
@@ -579,28 +576,26 @@ echo: echo: [1] HWID [Windows]
echo: [2] Ohook [Office]
echo: [3] TSforge [Windows / ESU / Office]
-echo: [4] KMS38 [Windows]
-echo: [5] Online KMS [Windows / Office]
+echo: [4] Online KMS [Windows / Office]
echo:
-echo: [6] HWID [Windows] ^+ Ohook [Office]
-echo: [7] HWID [Windows] ^+ Ohook [Office] ^+ TSforge [ESU]
-echo: [8] TSforge [Windows] ^+ Online KMS [Office]
+echo: [5] HWID [Windows] ^+ Ohook [Office]
+echo: [6] HWID [Windows] ^+ Ohook [Office] ^+ TSforge [ESU]
+echo: [7] TSforge [Windows] ^+ Online KMS [Office]
echo:
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
echo: [0] Go Back
echo: ____________________________________________________________
echo:
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
-choice /C:12345678R0 /N
+choice /C:1234567R0 /N
set _erl=%errorlevel%
-if %_erl%==10 goto:Extras
-if %_erl%==9 start %mas%oem-folder &goto:Extract$OEM$2
-if %_erl%==8 (set "_oem=TSforge [Windows] + Online KMS [Office]" & set "para=/Z-Windows /K-Office" &goto:Extract$OEM$3)
-if %_erl%==7 (set "_oem=HWID [Windows] + Ohook [Office] + TSforge [ESU]" & set "para=/HWID /Ohook /Z-ESU" &goto:Extract$OEM$3)
-if %_erl%==6 (set "_oem=HWID [Windows] + Ohook [Office]" & set "para=/HWID /Ohook" &goto:Extract$OEM$3)
-if %_erl%==5 (set "_oem=Online KMS" & set "para=/K-WindowsOffice" &goto:Extract$OEM$3)
-if %_erl%==4 (set "_oem=KMS38" & set "para=/KMS38" &goto:Extract$OEM$3)
+if %_erl%==9 goto:Extras
+if %_erl%==8 start %mas%oem-folder &goto:Extract$OEM$2
+if %_erl%==7 (set "_oem=TSforge [Windows] + Online KMS [Office]" & set "para=/Z-Windows /K-Office" &goto:Extract$OEM$3)
+if %_erl%==6 (set "_oem=HWID [Windows] + Ohook [Office] + TSforge [ESU]" & set "para=/HWID /Ohook /Z-ESU" &goto:Extract$OEM$3)
+if %_erl%==5 (set "_oem=HWID [Windows] + Ohook [Office]" & set "para=/HWID /Ohook" &goto:Extract$OEM$3)
+if %_erl%==4 (set "_oem=Online KMS" & set "para=/K-WindowsOffice" &goto:Extract$OEM$3)
if %_erl%==3 (set "_oem=TSforge" & set "para=/Z-WindowsESUOffice" &goto:Extract$OEM$3)
if %_erl%==2 (set "_oem=Ohook" & set "para=/Ohook" &goto:Extract$OEM$3)
if %_erl%==1 (set "_oem=HWID" & set "para=/HWID" &goto:Extract$OEM$3)
@@ -638,11 +633,6 @@ echo: call :dk_color %Blue% "%_oem%"
call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
)
-echo "%_oem%" | find /i "KMS38" 1>nul && (
-echo:
-echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
-echo Check this page %mas%oem-folder
-)
echo ___________________________________________________________________
echo:
call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
@@ -12055,756 +12045,6 @@ exit /b :+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-:KMS38Activation
-
-:: To activate, run the script with "/KMS38" parameter or change 0 to 1 in below line
-set _act=0
-
-:: To disable changing edition if current edition doesn't support KMS38 activation, change the value to 1 from 0 or run the script with "/KMS38-NoEditionChange" parameter
-set _NoEditionChange=0
-
-:: If value is changed in above lines or parameter is used then script will run in unattended mode
-
-::========================================================================================================================================
-
-cls
-color 07
-title KMS38 Activation %masver%
-
-set _args=
-set _elev=
-set _unattended=0
-
-set _args=%*
-if defined _args set _args=%_args:"=%
-if defined _args (
-for %%A in (%_args%) do (
-if /i "%%A"=="/KMS38" set _act=1
-if /i "%%A"=="/KMS38-NoEditionChange" set _NoEditionChange=1
-if /i "%%A"=="-el" set _elev=1
-)
-)
-
-for %%A in (%_act% %_NoEditionChange%) do (if "%%A"=="1" set _unattended=1)
-
-::========================================================================================================================================
-
-set _k38=
-call :dk_setvar
-set "specific_kms=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f"
-
-if %winbuild% LSS 14393 (
-%eline%
-echo Unsupported OS version detected [%winbuild%].
-echo KMS38 activation is only supported on Windows 10/11/Server, build 14393 and later.
-echo:
-if %winbuild% LSS 10240 (
-call :dk_color %Blue% "Use TSforge activation option from the main menu."
-) else (
-call :dk_color %Blue% "Use HWID activation option from the main menu."
-)
-goto dk_done
-)
-
-::========================================================================================================================================
-
-:k_menu
-
-if %_unattended%==0 (
-cls
-if not defined terminal mode 76, 25
-title KMS38 Activation %masver%
-
-echo:
-echo:
-echo:
-echo:
-echo: ______________________________________________________
-echo:
-echo [1] KMS38 Activation
-echo ____________________________________________
-echo:
-echo [2] Remove KMS38 Activation
-echo:
-echo [0] %_exitmsg%
-echo: ______________________________________________________
-echo:
-call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,0]"
-choice /C:120 /N
-set _el=!errorlevel!
-if !_el!==3 exit /b
-if !_el!==2 goto :k_uninstall
-if !_el!==1 goto :k_menu2
-goto :k_menu
-)
-
-::========================================================================================================================================
-
-:k_menu2
-
-cls
-if not defined terminal (
-mode 110, 34
-if exist "%SysPath%\spp\store_test\" mode 134, 34
-)
-title KMS38 Activation %masver%
-
-echo:
-echo Initializing...
-call :dk_chkmal
-
-if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" if not exist "%SysPath%\clipup.exe" set a_cor=1
-if not exist %SysPath%\sppsvc.exe (set _fmiss=sppsvc.exe)
-if not exist %SysPath%\ClipUp.exe if not defined a_cor (set _fmiss=%_fmiss%ClipUp.exe)
-
-if defined _fmiss (
-%eline%
-echo [%_fmiss%] file is missing, aborting...
-echo:
-if not defined results (
-call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run DISM Restore and SFC Scan options."
-call :dk_color %Blue% "After that, restart system and try activation again."
-echo:
-set fixes=%fixes% %mas%troubleshoot
-call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
-)
-goto dk_done
-)
-
-::========================================================================================================================================
-
-set spp=SoftwareLicensingProduct
-set sps=SoftwareLicensingService
-
-call :dk_ckeckwmic
-call :dk_checksku
-call :dk_product
-call :dk_sppissue
-
-::========================================================================================================================================
-
-:: Check if system is permanently activated or not
-
-call :dk_checkperm
-if defined _perm (
-cls
-echo ___________________________________________________________________________________________
-echo:
-call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
-call :dk_color2 %_White% " " %Gray% "Activation is not required."
-echo ___________________________________________________________________________________________
-if %_unattended%==1 goto dk_done
-echo:
-choice /C:10 /N /M "> [1] Activate Anyway [0] %_exitmsg% : "
-if errorlevel 2 exit /b
-)
-cls
-
-::========================================================================================================================================
-
-:: Check Evaluation version
-
-set _eval=
-set _evalserv=
-
-if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*EvalEdition~*.mum" set _eval=1
-if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*EvalEdition~*.mum" set _evalserv=1
-if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*EvalCorEdition~*.mum" set _eval=1 & set _evalserv=1
-
-if defined _eval (
-reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% && (
-%eline%
-echo [%winos% ^| %winbuild%]
-if defined _evalserv (
-echo Server Evaluation cannot be activated. Convert it to full Server OS.
-echo:
-call :dk_color %Blue% "Go Back to main menu and use [Change Edition] option."
-) else (
-echo Evaluation editions cannot be activated outside of their evaluation period.
-call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
-echo:
-set fixes=%fixes% %mas%evaluation_editions
-call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
-)
-goto dk_done
-)
-)
-
-::========================================================================================================================================
-
-:: Check clipup.exe for the detection and activation of server cor and acor editions
-
-if defined a_cor (
-if not exist "!_work!\clipup.exe" (
-%eline%
-echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions.
-echo The file is required for KMS38 activation.
-echo Check the below page for instructions on how to activate it.
-call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%kms38"
-goto dk_done
-)
-)
-
-:: Check file signature
-
-if defined a_cor (
-%psc% "if (-not (Get-AuthenticodeSignature -FilePath '!_work!\clipup.exe').IsOSBinary) {Exit 3}" %nul%
-if !errorlevel!==3 (
-%eline%
-echo Valid digital signature not found in clipup.exe file.
-call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
-goto dk_done
-)
-)
-
-::========================================================================================================================================
-
-set error=
-
-cls
-echo:
-call :dk_showosinfo
-
-::========================================================================================================================================
-
-echo Initiating Diagnostic Tests...
-
-set "_serv=ClipSVC sppsvc KeyIso Winmgmt"
-
-:: Client License Service (ClipSVC)
-:: Software Protection
-:: CNG Key Isolation
-:: Windows Management Instrumentation
-
-call :dk_errorcheck
-
-::========================================================================================================================================
-
-:: Check if GVLK (KMS key) is already installed or not
-
-call :k_channel
-
-:: Detect Key
-
-set key=
-set pkey=
-set altkey=
-set changekey=
-set altedition=
-
-call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
-if defined allapps call :kms38data key
-if not defined key call :k_gvlk %nul%
-if defined allapps if not defined key call :kms38fallback
-
-if defined altkey (set key=%altkey%&set changekey=1)
-
-set /a UBR=0
-if %osSKU%==191 if defined altkey if defined altedition (
-for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
-if %winbuild% LSS 22598 if !UBR! LSS 2788 (
-call :dk_color %Blue% "Windows must be updated to build 19044.2788 or higher for IotEnterpriseS KMS38 activation."
-)
-)
-
-if not defined key if defined notfoundaltactID (
-call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Activation ID Not Found]"
-)
-
-if not defined key if not defined _gvlk (
-echo:
-echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
-
-if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
-
-if defined skunotfound (
-call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
-set fixes=%fixes% %mas%troubleshoot
-call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
-)
-
-if defined sppks (
-call :dk_color %Red% "KMS38 activation is supported but failed to find the key."
-set fixes=%fixes% %mas%troubleshoot
-call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
-)
-
-if not defined skunotfound if not defined sppks (
-call :dk_color %Red% "This product does not support KMS38 activation."
-call :dk_color %Blue% "Use TSforge activation option from the main menu."
-set fixes=%fixes% %mas%
-echo %mas%
-)
-echo:
-goto dk_done
-)
-
-::========================================================================================================================================
-
-:: Install key
-
-echo:
-if defined changekey (
-call :dk_color %Blue% "[%altedition%] edition product key will be used to enable KMS38 activation."
-echo:
-)
-
-if defined winsub (
-call :dk_color %Blue% "Windows Subscription edition [SKU ID-%slcSKU%] found. Script will activate the base edition [SKU ID-%regSKU%]."
-echo:
-)
-
-set _partial=
-if not defined key (
-if %_wmic% EQU 1 for /f "tokens=2 delims==" %%# in ('wmic path %spp% where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey<>null AND LicenseDependsOn is NULL" Get PartialProductKey /value %nul6%') do set "_partial=%%#"
-if %_wmic% EQU 0 for /f "tokens=2 delims==" %%# in ('%psc% "(([WMISEARCHER]'SELECT PartialProductKey FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL').Get()).PartialProductKey | %% {echo ('PartialProductKey='+$_)}" %nul6%') do set "_partial=%%#"
-call echo Checking Installed Product Key [Partial Key - %%_partial%%] [Volume:GVLK]
-)
-
-if defined key (
-set generickey=1
-call :dk_inskey "[%key%]"
-)
-
-::========================================================================================================================================
-
-:: Check activation ID for setting specific KMS host
-
-set app=
-if %_wmic% EQU 1 for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and Description like '%%KMSCLIENT%%' and PartialProductKey is not NULL AND LicenseDependsOn is NULL) get ID /VALUE" %nul6%') do call set "app=%%a"
-if %_wmic% EQU 0 for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND Description like ''%%KMSCLIENT%%'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL').Get()).ID | %% {echo ('ID='+$_)}" %nul6%') do call set "app=%%a"
-
-if not defined app (
-call :dk_color %Red% "Checking Installed GVLK Activation ID [Not Found] Aborting..."
-set fixes=%fixes% %mas%troubleshoot
-call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
-goto :dk_done
-)
-
-::========================================================================================================================================
-
-:: Set specific KMS host to Local Host
-:: By doing this, global KMS IP can not replace KMS38 activation but can be used with Office and other Windows Editions
-
-echo:
-%nul% reg delete "HKLM\%specific_kms%" /f
-%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
-
-%nul% reg query "HKLM\%specific_kms%" && (
-call :dk_color %Blue% "Specific KMS registry is locked. %_fixmsg%"
-)
-
-set k_error=
-%nul% reg add "HKLM\%specific_kms%\%app%" /f /v KeyManagementServiceName /t REG_SZ /d "127.0.0.2" || set k_error=1
-%nul% reg add "HKLM\%specific_kms%\%app%" /f /v KeyManagementServicePort /t REG_SZ /d "1688" || set k_error=1
-
-if not defined k_error (
-echo Adding Specific KMS Host [LocalHost] [Successful]
-) else (
-call :dk_color %Red% "Adding Specific KMS Host [LocalHost] [Failed]"
-)
-
-::========================================================================================================================================
-
-:: Copy clipup.exe to System32 directory to activate Server Cor/Acor editions
-
-if defined a_cor (
-set "_clipup=%systemroot%\System32\clipup.exe"
-pushd "!_work!\"
-copy /y /b "ClipUp.exe" "!_clipup!" %nul%
-popd
-
-echo:
-if exist "!_clipup!" (
-echo Copying clipup.exe File to [%systemroot%\System32\] [Successful]
-) else (
-call :dk_color %Red% "Copying clipup.exe File to [%systemroot%\System32\] [Failed] Aborting..."
-goto :k_final
-)
-)
-
-::========================================================================================================================================
-
-:: Generate GenuineTicket.xml and apply
-:: In some cases clipup -v -o method fails and in some cases service restart method fails as well
-:: To maximize success rate and get better error details, script will install tickets two times (service restart + clipup -v -o)
-
-set "tdir=%ProgramData%\Microsoft\Windows\ClipSVC\GenuineTicket"
-if not exist "%tdir%\" md "%tdir%\" %nul%
-
-if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
-if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
-if exist "%ProgramData%\Microsoft\Windows\ClipSVC\Install\Migration\*" del /f /q "%ProgramData%\Microsoft\Windows\ClipSVC\Install\Migration\*" %nul%
-
-:: Generate ticket
-
-set "SessionIdStr=OSMajorVersion=5;OSMinorVersion=1;OSPlatformId=2;PP=0;GVLKExp=2038-01-19T03:14:07Z;DownlevelGenuineState=1;"
-%psc% "$f=[System.IO.File]::ReadAllText('!_batp!') -split ':sign\:.*';. ([scriptblock]::Create($f[1]))"
-
-copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
-
-if not exist "%tdir%\GenuineTicket.xml" (
-call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting...]"
-if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
-goto :k_final
-) else (
-echo Generating GenuineTicket.xml [Successful]
-)
-
-set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
-
-:: Stop sppsvc
-
-%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
-
-%_xmlexist% (
-%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
-%_xmlexist% timeout /t 2 %nul%
-%_xmlexist% timeout /t 2 %nul%
-
-%_xmlexist% (
-set error=1
-if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
-call :dk_color %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
-)
-)
-
-copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
-clipup -v -o
-
-set rebuildinfo=
-
-if not exist %ProgramData%\Microsoft\Windows\ClipSVC\tokens.dat (
-set error=1
-set rebuildinfo=1
-call :dk_color %Red% "Checking ClipSVC tokens.dat [Not Found]"
-)
-
-%_xmlexist% (
-set error=1
-set rebuildinfo=1
-call :dk_color %Red% "Installing GenuineTicket.xml [Failed With clipup -v -o]"
-)
-
-if exist "%ProgramData%\Microsoft\Windows\ClipSVC\Install\Migration\*.xml" (
-set error=1
-set rebuildinfo=1
-call :dk_color %Red% "Checking Ticket Migration [Failed]"
-)
-
-if not defined showfix if defined rebuildinfo (
-set showfix=1
-echo:
-call :dk_color %Blue% "%_fixmsg%"
-echo:
-)
-
-if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
-
-::==========================================================================================================================================
-
-call :dk_product
-
-echo:
-echo Activating...
-echo:
-
-call :k_checkexp
-if defined _k38 (
-call :k_actinfo
-goto :k_final
-)
-
-:: Clear 180 Days KMS Activation lock with Windows SKU specific rearm and without the need to restart the system
-
-if %_wmic% EQU 1 wmic path %spp% where ID='%app%' call ReArmsku %nul%
-if %_wmic% EQU 0 %psc% "$null=([WMI]'%spp%=''%app%''').ReArmsku()" %nul%
-
-if %errorlevel%==0 (
-echo Applying SKU-ID Rearm [Successful]
-) else (
-call :dk_color %Red% "Applying SKU-ID Rearm [Failed]"
-)
-call :dk_refresh
-
-echo:
-call :k_checkexp
-if defined _k38 (
-call :k_actinfo
-goto :k_final
-)
-
-call :dk_color %Red% "Activation Failed"
-if not defined error call :dk_color %Blue% "%_fixmsg%"
-set fixes=%fixes% %mas%troubleshoot
-call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
-
-::========================================================================================================================================
-
-:k_final
-
-:: Remove the specific KMS host (LocalHost) added by the script if activation is not completed
-
-echo:
-if not defined _k38 (
-%nul% reg delete "HKLM\%specific_kms%" /f
-%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
-%nul% reg query "HKLM\%specific_kms%" && (
-call :dk_color %Red% "Removing the Added Specific KMS Host [Failed]"
-) || (
-echo Removing the Added Specific KMS Host [Successful]
-)
-)
-
-if defined _k38 if %winbuild% GEQ 26200 (
-call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored."
-call :dk_color %Gray% "To avoid this notification, please use the HWID or TSforge activation options in the main menu."
-)
-
-:: clipup.exe does not exist in server cor and acor editions by default, it was copied there with this script
-
-if defined a_cor if exist "%_clipup%" del /f /q "%_clipup%" %nul%
-
-if defined a_cor (
-if exist "%_clipup%" (
-call :dk_color %Red% "Deleting Copied clipup.exe File [Failed]"
-) else (
-echo Deleting Copied clipup.exe File [Successful]
-)
-)
-
-for %%# in (407) do if %osSKU%==%%# (
-call :dk_color %Red% "%winos% does not support activation on non-azure platforms."
-)
-
-:: Trigger reevaluation of SPP's Scheduled Tasks
-
-if defined _k38 (
-call :dk_reeval %nul%
-)
-goto :dk_done
-
-::========================================================================================================================================
-
-:k_uninstall
-
-cls
-if not defined terminal mode 99, 28
-title Remove KMS38 Activation %masver%
-
-%nul% reg delete "HKLM\%specific_kms%" /f
-%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
-
-echo:
-%nul% reg query "HKLM\%specific_kms%" && (
-call :dk_color %Red% "Failed to remove specific KMS Host."
-call :dk_color %Blue% "%_fixmsg%"
-) || (
-echo Successfully removed specific KMS Host.
-)
-
-echo:
-echo KMS38 activation doesn't modify any Windows components and doesn't install any new files.
-echo:
-call :dk_color %Gray% "If you want to reset the activation status,"
-call :dk_color %Blue% "%_fixmsg%"
-echo:
-
-goto :dk_done
-
-::========================================================================================================================================
-
-:: Check KMS activation status
-
-:k_actinfo
-
-set xpr=
-for /f "tokens=* delims=" %%# in ('%psc% "$([DateTime]::Now.addMinutes(%gpr%)).ToString('yyyy-MM-dd HH:mm:ss')" %nul6%') do set "xpr=%%#"
-call :dk_color %Green% "%winos% is activated till !xpr!"
-exit /b
-
-:: Check remaining KMS activation grace period
-
-:k_checkexp
-
-set gpr=0
-if %_wmic% EQU 1 for /f "tokens=2 delims==" %%# in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and Description like '%%KMSCLIENT%%' and PartialProductKey is not NULL AND LicenseDependsOn is NULL) get GracePeriodRemaining /VALUE" %nul6%') do set "gpr=%%#"
-if %_wmic% EQU 0 for /f "tokens=2 delims==" %%# in ('%psc% "(([WMISEARCHER]'SELECT GracePeriodRemaining FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND Description like ''%%KMSCLIENT%%'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL').Get()).GracePeriodRemaining | %% {echo ('GracePeriodRemaining='+$_)}" %nul6%') do set "gpr=%%#"
-if %gpr% GTR 259200 (set _k38=1) else (set _k38=)
-exit /b
-
-:: Get Windows installed key channel
-
-:k_channel
-
-set _gvlk=
-if %_wmic% EQU 1 for /f "tokens=2 delims==" %%# in ('wmic path %spp% where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL and Description like '%%KMSCLIENT%%'" Get Name /value %nul6%') do (echo %%# findstr /i "Windows" %nul1% && set _gvlk=1)
-if %_wmic% EQU 0 for /f "tokens=2 delims==" %%# in ('%psc% "(([WMISEARCHER]'SELECT Name FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL and Description like ''%%KMSCLIENT%%''').Get()).Name | %% {echo ('Name='+$_)}" %nul6%') do (echo %%# findstr /i "Windows" %nul1% && set _gvlk=1)
-exit /b
-
-::========================================================================================================================================
-
-:: Get Product Key from pkeyhelper.dll for future new editions
-:: It works on Windows 10 1803 (17134) and later builds.
-
-:k_pkey
-
-call :dk_reflection
-
-set d1=%ref% [void]$TypeBuilder.DefinePInvokeMethod('SkuGetProductKeyForEdition', 'pkeyhelper.dll', 'Public, Static', 1, [int], @([int], [String], [String].MakeByRefType(), [String].MakeByRefType()), 1, 3);
-set d1=%d1% $out = ''; [void]$TypeBuilder.CreateType()::SkuGetProductKeyForEdition(%1, %2, [ref]$out, [ref]$null); $out
-
-set pkey=
-for /f %%a in ('%psc% "%d1%"') do if not errorlevel 1 (set pkey=%%a)
-exit /b
-
-:: Get channel name for the key which was extracted from pkeyhelper.dll
-
-:k_pkeychannel
-
-set k=%1
-set m=[Runtime.InteropServices.Marshal]
-set p=%SysPath%\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms
-
-set d1=%ref% [void]$TypeBuilder.DefinePInvokeMethod('PidGenX', 'pidgenx.dll', 'Public, Static', 1, [int], @([String], [String], [String], [int], [IntPtr], [IntPtr], [IntPtr]), 1, 3);
-set d1=%d1% $r = [byte[]]::new(0x04F8); $r[0] = 0xF8; $r[1] = 0x04; $f = %m%::AllocHGlobal(0x04F8); %m%::Copy($r, 0, $f, 0x04F8);
-set d1=%d1% [void]$TypeBuilder.CreateType()::PidGenX('%k%', '%p%', '00000', 0, 0, 0, $f); %m%::Copy($f, $r, 0, 0x04F8); %m%::FreeHGlobal($f); [Text.Encoding]::Unicode.GetString($r, 1016, 128)
-
-set pkeychannel=
-for /f %%a in ('%psc% "%d1%"') do if not errorlevel 1 (set pkeychannel=%%a)
-exit /b
-
-:k_gvlk
-
-for %%# in (pkeyhelper.dll) do @if "%%~$PATH:#"=="" exit /b
-for %%# in (Volume:GVLK) do (
-call :k_pkey %osSKU% '%%#'
-if defined pkey call :k_pkeychannel !pkey!
-if /i "!pkeychannel!"=="%%#" (
-set key=!pkey!
-exit /b
-)
-)
-exit /b
-
-::========================================================================================================================================
-
-:: 1st column = Activation ID
-:: 2nd column = GVLK (Generic volume licensing key)
-:: 3rd column = SKU ID
-:: 4th column = WMI Edition ID (For reference only)
-:: 5th column = Build Branch name incase same Edition ID is used in different OS versions with different key (For reference only)
-:: Separator = "_"
-
-:kms38data
-
-set f=
-for %%# in (
-:: Windows 10/11
-73111121-5638-40f6-bc11-f1d7b0d64300_NPPR9-FWDCX-D2C8J-H872K-2Y%f%T43___4_Enterprise
-e272e3e2-732f-4c65-a8f0-484747d0d947_DPH2V-TTNVB-4X9Q3-TJR4H-KH%f%JW4__27_EnterpriseN
-2de67392-b7a7-462a-b1ca-108dd189f588_W269N-WFGWX-YVC9B-4J6C9-T8%f%3GX__48_Professional
-a80b5abf-76ad-428b-b05d-a47d2dffeebf_MH37W-N47XK-V7XM9-C7227-GC%f%QG9__49_ProfessionalN
-7b9e1751-a8da-4f75-9560-5fadfe3d8e38_3KHY7-WNT83-DGQKR-F7HPR-84%f%4BM__98_CoreN
-a9107544-f4a0-4053-a96a-1479abdef912_PVMJN-6DFY6-9CCP6-7BKTT-D3%f%WVR__99_CoreCountrySpecific
-cd918a57-a41b-4c82-8dce-1a538e221a83_7HNRX-D7KGG-3K4RQ-4WPJ4-YT%f%DFH_100_CoreSingleLanguage
-58e97c99-f377-4ef1-81d5-4ad5522b5fd8_TX9XD-98N7V-6WMQ6-BX7FG-H8%f%Q99_101_Core
-e0c42288-980c-4788-a014-c080d2e1926e_NW6C2-QMPVW-D7KKK-3GKT6-VC%f%FB2_121_Education
-3c102355-d027-42c6-ad23-2e7ef8a02585_2WH4N-8QGBV-H22JP-CT43Q-MD%f%WWJ_122_EducationN
-32d2fab3-e4a8-42c2-923b-4bf4fd13e6ee_M7XTQ-FN8P6-TTKYV-9D4CC-J4%f%62D_125_EnterpriseS_RS5,VB,Ge
-2d5a5a60-3040-48bf-beb0-fcd770c20ce0_DCPHK-NFMTC-H88MJ-PFHPY-QJ%f%4BJ_125_EnterpriseS_RS1
-7b51a46c-0c04-4e8f-9af4-8496cca90d5e_WNMTR-4C88C-JK8YV-HQ7T2-76%f%DF9_125_EnterpriseS_TH1
-7103a333-b8c8-49cc-93ce-d37c09687f92_92NFX-8DJQP-P6BBQ-THF9C-7C%f%G2H_126_EnterpriseSN_RS5,VB,Ge
-9f776d83-7156-45b2-8a5c-359b9c9f22a3_QFFDN-GRT3P-VKWWX-X7T3R-8B%f%639_126_EnterpriseSN_RS1
-87b838b7-41b6-4590-8318-5797951d8529_2F77B-TNFGY-69QQF-B8YKP-D6%f%9TJ_126_EnterpriseSN_TH1
-82bbc092-bc50-4e16-8e18-b74fc486aec3_NRG8B-VKK3Q-CXVCJ-9G2XF-6Q%f%84J_161_ProfessionalWorkstation
-4b1571d3-bafb-4b40-8087-a961be2caf65_9FNHH-K3HBT-3W4TD-6383H-6X%f%YWF_162_ProfessionalWorkstationN
-3f1afc82-f8ac-4f6c-8005-1d233e606eee_6TP4R-GNPTD-KYYHQ-7B7DP-J4%f%47Y_164_ProfessionalEducation
-5300b18c-2e33-4dc2-8291-47ffcec746dd_YVWGF-BXNMC-HTQYQ-CPQ99-66%f%QFC_165_ProfessionalEducationN
-e0b2d383-d112-413f-8a80-97f373a5820c_YYVX9-NTFWV-6MDM3-9PT4T-4M%f%68B_171_EnterpriseG
-e38454fb-41a4-4f59-a5dc-25080e354730_44RPN-FTY23-9VTTB-MP9BX-T8%f%4FV_172_EnterpriseGN
-ec868e65-fadf-4759-b23e-93fe37f2cc29_CPWHC-NT2C7-VYW78-DHDB2-PG%f%3GK_175_ServerRdsh_RS5
-e4db50ea-bda1-4566-b047-0ca50abc6f07_7NBT4-WGBQX-MP4H7-QXFF8-YP%f%3KX_175_ServerRdsh_RS3
-0df4f814-3f57-4b8b-9a9d-fddadcd69fac_NBTWJ-3DR69-3C4V8-C26MC-GQ%f%9M6_183_CloudE
-59eb965c-9150-42b7-a0ec-22151b9897c5_KBN8V-HFGQ4-MGXVD-347P6-PD%f%QGT_191_IoTEnterpriseS_VB,NI
-d30136fc-cb4b-416e-a23d-87207abc44a9_6XN7V-PCBDC-BDBRH-8DQY7-G6%f%R44_202_CloudEditionN
-ca7df2e3-5ea0-47b8-9ac1-b1be4d8edd69_37D7F-N49CB-WQR8W-TBJ73-FM%f%8RX_203_CloudEdition
-:: Windows 2016/19/22/25 LTSC/SAC
-7dc26449-db21-4e09-ba37-28f2958506a6_TVRH6-WHNXV-R9WG3-9XRFY-MY%f%832___7_ServerStandard_Ge
-9bd77860-9b31-4b7b-96ad-2564017315bf_VDYBN-27WPP-V4HQT-9VMD4-VM%f%K7H___7_ServerStandard_FE
-de32eafd-aaee-4662-9444-c1befb41bde2_N69G4-B89J2-4G8F4-WWYCC-J4%f%64C___7_ServerStandard_RS5
-8c1c5410-9f39-4805-8c9d-63a07706358f_WC2BQ-8NRM3-FDDYY-2BFGV-KH%f%KQY___7_ServerStandard_RS1
-c052f164-cdf6-409a-a0cb-853ba0f0f55a_D764K-2NDRG-47T6Q-P8T8W-YP%f%6DF___8_ServerDatacenter_Ge
-ef6cfc9f-8c5d-44ac-9aad-de6a2ea0ae03_WX4NM-KYWYW-QJJR4-XV3QB-6V%f%M33___8_ServerDatacenter_FE
-34e1ae55-27f8-4950-8877-7a03be5fb181_WMDGN-G9PQG-XVVXX-R3X43-63%f%DFG___8_ServerDatacenter_RS5
-21c56779-b449-4d20-adfc-eece0e1ad74b_CB7KF-BWN84-R7R2Y-793K2-8X%f%DDG___8_ServerDatacenter_RS1
-034d3cbb-5d4b-4245-b3f8-f84571314078_WVDHN-86M7X-466P6-VHXV7-YY%f%726__50_ServerSolution_RS5
-2b5a1b0f-a5ab-4c54-ac2f-a6d94824a283_JCKRF-N37P4-C2D82-9YXRT-4M%f%63B__50_ServerSolution_RS1
-7b4433f4-b1e7-4788-895a-c45378d38253_QN4C6-GBJD2-FB422-GHWJK-GJ%f%G2R_110_ServerCloudStorage
-8de8eb62-bbe0-40ac-ac17-f75595071ea3_GRFBW-QNDC4-6QBHG-CCK3B-2P%f%R88_120_ServerARM64_RS5
-43d9af6e-5e86-4be8-a797-d072a046896c_K9FYF-G6NCK-73M32-XMVPY-F9%f%DRR_120_ServerARM64_RS4
-39e69c41-42b4-4a0a-abad-8e3c10a797cc_QFND9-D3Y9C-J3KKY-6RPVP-2D%f%PYV_145_ServerDatacenterACor_FE
-90c362e5-0da1-4bfd-b53b-b87d309ade43_6NMRW-2C8FM-D24W7-TQWMY-CW%f%H2D_145_ServerDatacenterACor_RS5
-e49c08e7-da82-42f8-bde2-b570fbcae76c_2HXDN-KRXHB-GPYC7-YCKFJ-7F%f%VDG_145_ServerDatacenterACor_RS3
-f5e9429c-f50b-4b98-b15c-ef92eb5cff39_67KN8-4FYJW-2487Q-MQ2J7-4C%f%4RG_146_ServerStandardACor_FE
-73e3957c-fc0c-400d-9184-5f7b6f2eb409_N2KJX-J94YW-TQVFB-DG9YT-72%f%4CC_146_ServerStandardACor_RS5
-61c5ef22-f14f-4553-a824-c4b31e84b100_PTXN8-JFHJM-4WC78-MPCBR-9W%f%4KR_146_ServerStandardACor_RS3
-45b5aff2-60a0-42f2-bc4b-ec6e5f7b527e_FCNV3-279Q9-BQB46-FTKXX-9H%f%PRH_168_ServerAzureCor_Ge
-8c8f0ad3-9a43-4e05-b840-93b8d1475cbc_6N379-GGTMK-23C6M-XVVTC-CK%f%FRQ_168_ServerAzureCor_FE
-a99cc1f0-7719-4306-9645-294102fbff95_FDNH6-VW9RW-BXPJ7-4XTYG-23%f%9TB_168_ServerAzureCor_RS5
-3dbf341b-5f6c-4fa7-b936-699dce9e263f_VP34G-4NPPG-79JTQ-864T4-R3%f%MQX_168_ServerAzureCor_RS1
-c2e946d1-cfa2-4523-8c87-30bc696ee584_XGN3F-F394H-FD2MY-PP6FD-8M%f%CRC_407_ServerTurbine_Ge
-19b5e0fb-4431-46bc-bac1-2f1873e4ae73_NTBV8-9K7Q8-V27C6-M2BTV-KH%f%MXV_407_ServerTurbine_RS5
-) do (
-for /f "tokens=1-5 delims=_" %%A in ("%%#") do if %osSKU%==%%C (
-if %1==key if not defined key echo "!allapps!" | find /i "%%A" %nul1% && set key=%%B
-)
-)
-exit /b
-
-::========================================================================================================================================
-
-:: Below code is used to get alternate edition name and key if current edition doesn't support KMS38 activation
-
-:: 1st column = Current SKU ID
-:: 2nd column = Current Edition Name
-:: 3rd column = Current Edition Activation ID
-:: 4th column = Alternate Edition Activation ID
-:: 5th column = Alternate Edition GVLK
-:: 6th column = Alternate Edition Name
-:: Separator = _
-
-
-:kms38fallback
-
-set notfoundaltactID=
-if %_NoEditionChange%==1 exit /b
-
-for %%# in (
-188_IoTEnterprise__________________8ab9bdd1-1f67-4997-82d9-8878520837d9_73111121-5638-40f6-bc11-f1d7b0d64300_NPPR9-FWDCX-D2C8J-H872K-2Y%f%T43_Enterprise
-206_IoTEnterpriseK_________________80083eae-7031-4394-9e88-4901973d56fe_73111121-5638-40f6-bc11-f1d7b0d64300_NPPR9-FWDCX-D2C8J-H872K-2Y%f%T43_Enterprise
-191_IoTEnterpriseS-2021____________ed655016-a9e8-4434-95d9-4345352c2552_32d2fab3-e4a8-42c2-923b-4bf4fd13e6ee_M7XTQ-FN8P6-TTKYV-9D4CC-J4%f%62D_EnterpriseS-2021
-205_IoTEnterpriseSK________________d4f9b41f-205c-405e-8e08-3d16e88e02be_59eb965c-9150-42b7-a0ec-22151b9897c5_KBN8V-HFGQ4-MGXVD-347P6-PD%f%QGT_IoTEnterpriseS
-138_ProfessionalSingleLanguage_____a48938aa-62fa-4966-9d44-9f04da3f72f2_2de67392-b7a7-462a-b1ca-108dd189f588_W269N-WFGWX-YVC9B-4J6C9-T8%f%3GX_Professional
-139_ProfessionalCountrySpecific____f7af7d09-40e4-419c-a49b-eae366689ebd_2de67392-b7a7-462a-b1ca-108dd189f588_W269N-WFGWX-YVC9B-4J6C9-T8%f%3GX_Professional
-139_ProfessionalCountrySpecific-Zn_01eb852c-424d-4060-94b8-c10d799d7364_2de67392-b7a7-462a-b1ca-108dd189f588_W269N-WFGWX-YVC9B-4J6C9-T8%f%3GX_Professional
-) do (
-for /f "tokens=1-6 delims=_" %%A in ("%%#") do if %osSKU%==%%A (
-echo "!allapps!" | find /i "%%C" %nul1% && (
-echo "!allapps!" | find /i "%%D" %nul1% && (
-set altkey=%%E
-set altedition=%%F
-) || (
-set altedition=%%F
-set notfoundaltactID=1
-)
-)
-)
-)
-exit /b
-
-:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
:KMSActivation
:: To activate Windows with K-M-S activation, run the script with "/K-Windows" parameter or change 0 to 1 in below line
@@ -13080,7 +12320,7 @@ set altedition= call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
if defined allapps call :ksdata winkey
if not defined key call :k_gvlk %nul%
-if defined allapps if not defined key call :kms38fallback
+if defined allapps if not defined key call :kmsfallback
if defined altkey (set key=%altkey%&set changekey=1)
@@ -14655,6 +13895,63 @@ exit /b ::========================================================================================================================================
+:: Get Windows installed key channel
+
+:k_channel
+
+set _gvlk=
+if %_wmic% EQU 1 for /f "tokens=2 delims==" %%# in ('wmic path %spp% where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' and PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL and Description like '%%KMSCLIENT%%'" Get Name /value %nul6%') do (echo %%# findstr /i "Windows" %nul1% && set _gvlk=1)
+if %_wmic% EQU 0 for /f "tokens=2 delims==" %%# in ('%psc% "(([WMISEARCHER]'SELECT Name FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL and Description like ''%%KMSCLIENT%%''').Get()).Name | %% {echo ('Name='+$_)}" %nul6%') do (echo %%# findstr /i "Windows" %nul1% && set _gvlk=1)
+exit /b
+
+
+::========================================================================================================================================
+
+:: Get Product Key from pkeyhelper.dll for future new editions
+:: It works on Windows 10 1803 (17134) and later builds.
+
+:k_pkey
+
+call :dk_reflection
+
+set d1=%ref% [void]$TypeBuilder.DefinePInvokeMethod('SkuGetProductKeyForEdition', 'pkeyhelper.dll', 'Public, Static', 1, [int], @([int], [String], [String].MakeByRefType(), [String].MakeByRefType()), 1, 3);
+set d1=%d1% $out = ''; [void]$TypeBuilder.CreateType()::SkuGetProductKeyForEdition(%1, %2, [ref]$out, [ref]$null); $out
+
+set pkey=
+for /f %%a in ('%psc% "%d1%"') do if not errorlevel 1 (set pkey=%%a)
+exit /b
+
+:: Get channel name for the key which was extracted from pkeyhelper.dll
+
+:k_pkeychannel
+
+set k=%1
+set m=[Runtime.InteropServices.Marshal]
+set p=%SysPath%\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms
+
+set d1=%ref% [void]$TypeBuilder.DefinePInvokeMethod('PidGenX', 'pidgenx.dll', 'Public, Static', 1, [int], @([String], [String], [String], [int], [IntPtr], [IntPtr], [IntPtr]), 1, 3);
+set d1=%d1% $r = [byte[]]::new(0x04F8); $r[0] = 0xF8; $r[1] = 0x04; $f = %m%::AllocHGlobal(0x04F8); %m%::Copy($r, 0, $f, 0x04F8);
+set d1=%d1% [void]$TypeBuilder.CreateType()::PidGenX('%k%', '%p%', '00000', 0, 0, 0, $f); %m%::Copy($f, $r, 0, 0x04F8); %m%::FreeHGlobal($f); [Text.Encoding]::Unicode.GetString($r, 1016, 128)
+
+set pkeychannel=
+for /f %%a in ('%psc% "%d1%"') do if not errorlevel 1 (set pkeychannel=%%a)
+exit /b
+
+:k_gvlk
+
+for %%# in (pkeyhelper.dll) do @if "%%~$PATH:#"=="" exit /b
+for %%# in (Volume:GVLK) do (
+call :k_pkey %osSKU% '%%#'
+if defined pkey call :k_pkeychannel !pkey!
+if /i "!pkeychannel!"=="%%#" (
+set key=!pkey!
+exit /b
+)
+)
+exit /b
+
+::========================================================================================================================================
+
:: 1st column = Office version number
:: 2nd column = Activation ID
:: 3rd column = Product ID from branding.xml
@@ -15129,6 +14426,47 @@ set _allactid=!_allactid! %%A )
exit /b
+::========================================================================================================================================
+
+:: Below code is used to get alternate edition name and key if current edition doesn't support K-M-S activation
+
+:: 1st column = Current SKU ID
+:: 2nd column = Current Edition Name
+:: 3rd column = Current Edition Activation ID
+:: 4th column = Alternate Edition Activation ID
+:: 5th column = Alternate Edition GVLK
+:: 6th column = Alternate Edition Name
+:: Separator = _
+
+
+:kmsfallback
+
+set notfoundaltactID=
+if %_NoEditionChange%==1 exit /b
+
+for %%# in (
+188_IoTEnterprise__________________8ab9bdd1-1f67-4997-82d9-8878520837d9_73111121-5638-40f6-bc11-f1d7b0d64300_NPPR9-FWDCX-D2C8J-H872K-2Y%f%T43_Enterprise
+206_IoTEnterpriseK_________________80083eae-7031-4394-9e88-4901973d56fe_73111121-5638-40f6-bc11-f1d7b0d64300_NPPR9-FWDCX-D2C8J-H872K-2Y%f%T43_Enterprise
+191_IoTEnterpriseS-2021____________ed655016-a9e8-4434-95d9-4345352c2552_32d2fab3-e4a8-42c2-923b-4bf4fd13e6ee_M7XTQ-FN8P6-TTKYV-9D4CC-J4%f%62D_EnterpriseS-2021
+205_IoTEnterpriseSK________________d4f9b41f-205c-405e-8e08-3d16e88e02be_59eb965c-9150-42b7-a0ec-22151b9897c5_KBN8V-HFGQ4-MGXVD-347P6-PD%f%QGT_IoTEnterpriseS
+138_ProfessionalSingleLanguage_____a48938aa-62fa-4966-9d44-9f04da3f72f2_2de67392-b7a7-462a-b1ca-108dd189f588_W269N-WFGWX-YVC9B-4J6C9-T8%f%3GX_Professional
+139_ProfessionalCountrySpecific____f7af7d09-40e4-419c-a49b-eae366689ebd_2de67392-b7a7-462a-b1ca-108dd189f588_W269N-WFGWX-YVC9B-4J6C9-T8%f%3GX_Professional
+139_ProfessionalCountrySpecific-Zn_01eb852c-424d-4060-94b8-c10d799d7364_2de67392-b7a7-462a-b1ca-108dd189f588_W269N-WFGWX-YVC9B-4J6C9-T8%f%3GX_Professional
+) do (
+for /f "tokens=1-6 delims=_" %%A in ("%%#") do if %osSKU%==%%A (
+echo "!allapps!" | find /i "%%C" %nul1% && (
+echo "!allapps!" | find /i "%%D" %nul1% && (
+set altkey=%%E
+set altedition=%%F
+) || (
+set altedition=%%F
+set notfoundaltactID=1
+)
+)
+)
+)
+exit /b
+
:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:check_actstatus
|
