summaryrefslogtreecommitdiff
path: root/MAS/All-In-One-Version-KL/MAS_AIO.cmd
diff options
context:
space:
mode:
Diffstat (limited to 'MAS/All-In-One-Version-KL/MAS_AIO.cmd')
-rw-r--r--MAS/All-In-One-Version-KL/MAS_AIO.cmd1111
1 files changed, 263 insertions, 848 deletions
diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd
index a29aecc..db84bb8 100644
--- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd
+++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd
@@ -1,5 +1,5 @@
@::r45f3r3-random
-@set masver=3.7
+@set masver=3.8
@setlocal DisableDelayedExpansion
@echo off
@@ -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)
@@ -454,6 +453,7 @@ if %winbuild% GEQ 10240 if %winbuild% LEQ 19045 if not defined _serexist if not
call :dk_color2 %_Green% " Tip:" %_White% " To activate ESU updates after W10 EOL, use TSforge option."
)
echo:
+echo:
echo: ______________________________________________________________
echo:
echo: Activation Methods:
@@ -473,34 +473,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
@@ -576,31 +574,29 @@ echo:
echo: Extract $OEM$ folder on the desktop
echo: ____________________________________________________________
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: [1] HWID [Windows]
+echo: [2] Ohook [Office]
+echo: [3] TSforge [Windows / ESU / 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 / ESU] ^+ Ohook [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 / ESU] + Ohook [Office]" & set "para=/Z-Windows /Z-ESU /Ohook" &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 +634,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%..."
@@ -728,8 +719,8 @@ 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"
+set fixes=%fixes% %mas%in-place_repair_upgrade
+call :dk_color2 %Blue% "If it still shows the same error, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
goto dk_done
)
@@ -1474,6 +1465,11 @@ set spperror=%errorlevel%
if %spperror% NEQ 1056 if %spperror% NEQ 0 (
%eline%
echo sc start %_slser% [Error Code: %spperror%]
+if %spperror% EQU 1053 (
+echo:
+call :dk_color %Blue% "Reboot your machine using the restart option and try again."
+call :dk_color %Blue% "If it still does not work, go back to Main Menu, select Troubleshoot and run Fix WPA Registry option."
+)
)
echo:
@@ -1785,6 +1781,13 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
if %errorlevel% NEQ 0 set wmifailed=1
+
+if %_wmic% EQU 1 wmic path %sps% get Version %nul%
+if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
+set error_code=%errorlevel%
+cmd /c exit /b %error_code%
+if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
+
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
if defined wmifailed (
@@ -1978,12 +1981,6 @@ set showfix=1
:: Check SoftwareLicensingService
-if %_wmic% EQU 1 wmic path %sps% get Version %nul%
-if %_wmic% EQU 0 %psc% "try { $null=([WMISEARCHER]'SELECT * FROM %sps%').Get().Version; exit 0 } catch { exit $_.Exception.InnerException.HResult }" %nul%
-set error_code=%errorlevel%
-cmd /c exit /b %error_code%
-if %error_code% NEQ 0 set "error_code=0x%=ExitCode%"
-
if %error_code% NEQ 0 (
call :dk_color %Red% "Checking SoftwareLicensingService [Not Working] [%error_code%]"
if not defined showfix (
@@ -2130,7 +2127,9 @@ call :dk_color %Gray% "Checking SLC/WMI SKU [Difference Found
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
-if exist "%SysPath%\wlms\wlms.exe" (
+sc query wlms %nul%
+
+if %errorlevel% NEQ 1060 (
echo Checking Eval WLMS Service [Found]
)
@@ -2348,6 +2347,7 @@ d4bdc678-0a4b-4a32-a5b3-aaa24c3b0f24_K9VKN-3BGWV-Y624W-MCRMQ-BH%f%DCD_202_X22-53
92fb8726-92a8-4ffc-94ce-f82e07444653_KY7PN-VR6RX-83W6Y-6DDYQ-T6%f%R4W_203_X22-53847_0_____Retail_CloudEdition
5a85300a-bfce-474f-ac07-a30983e3fb90_N979K-XWD77-YW3GB-HBGH6-D3%f%2MH_205_X23-15042_0_____OEM:DM_IoTEnterpriseSK
80083eae-7031-4394-9e88-4901973d56fe_P8Q7T-WNK7X-PMFXY-VXHBG-RR%f%K69_206_X23-62084_0_____OEM:DM_IoTEnterpriseK
+1bc2140b-285b-4351-b99c-26a126104b29_TMP2N-KGFHJ-PWM6F-68KCQ-3P%f%JBP_210_X23-60513_0_____Retail_WNC
) do (
for /f "tokens=1-9 delims=_" %%A in ("%%#") do (
@@ -2577,8 +2577,8 @@ 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"
+set fixes=%fixes% %mas%in-place_repair_upgrade
+call :dk_color2 %Blue% "If it still shows the same error, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
goto dk_done
)
@@ -3618,10 +3618,10 @@ reg unload HKU\!defname! %nul%
if defined vnextexist (
echo:
-call :dk_color %Gray% "Office vNext subscription detected:"
-call :dk_color %Blue% "If active, this license overrides other activation methods."
-call :dk_color %Blue% "If expiring soon, rerun the script after expiration."
-call :dk_color2 %Blue% "If expired and script activation fails, get help - " %_Yellow% " %mas%troubleshoot"
+call :dk_color %Gray% "The logged-in Office account has a subscription license."
+call :dk_color %Blue% "If the subscription is active, it overrides other activation methods."
+call :dk_color %Blue% "If it is expiring soon, rerun the activation script after it expires."
+call :dk_color2 %Blue% "If it has already expired and activation fails, get help here - " %_Yellow% " %mas%troubleshoot"
echo:
)
@@ -4546,8 +4546,8 @@ 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"
+set fixes=%fixes% %mas%in-place_repair_upgrade
+call :dk_color2 %Blue% "If it still shows the same error, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
goto dk_done
)
@@ -5052,12 +5052,17 @@ if exist "%SystemRoot%\Servicing\Packages\WinEmb-Branding-Embedded-Standard-Pack
)
if not defined allapps call :dk_actids 55c92734-d682-4d71-983e-d6ec3f16059f
-set w10EsuEditions=Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN-ServerRdsh
+set w10EsuEditions=Education-EducationN-Enterprise-EnterpriseN-Professional-ProfessionalEducation-ProfessionalEducationN-ProfessionalN-ProfessionalWorkstation-ProfessionalWorkstationN
+
+set minbuild=0
+if /i %tsedition%==ServerRdsh set minbuild=5552
+for %%# in (Core CoreN CoreCountrySpecific CoreSingleLanguage) do (if /i %tsedition%==%%# set minbuild=6156)
+if /i %tsedition%==PPIPro set minbuild=6388
set /a UBR=0
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% EQU 19045 if %UBR% GEQ 6156 (
-set w10EsuEditionsLaterAdded=Core-CoreN-CoreCountrySpecific-CoreSingleLanguage-IoTEnterprise-
+if %winbuild% EQU 19045 if %minbuild% GTR 0 if %UBR% GEQ %minbuild% (
+set w10EsuEditionsLaterAdded=%tsedition%-
)
if not defined isThinpc if not defined isltsc for %%# in (
@@ -5807,14 +5812,14 @@ $filteredResults = $results | Where-Object {
$true
}
else {
- $_.Name -notlike "*CountrySpecific*"
+ $_.Name -like "*ESU*" -or $_.Name -notlike "*CountrySpecific*"
}
} | Where-Object {
if ($env:tsedition -like "*CloudEdition*") {
$true
}
else {
- $_.Name -notlike "*CloudEdition*"
+ $_.Name -like "*ESU*" -or $_.Name -notlike "*CloudEdition*"
}
} | Where-Object {
$_.Name -like "*CountrySpecific*" -or (IsMuiNotLocked $_.ID)
@@ -5888,22 +5893,26 @@ if %_actman%==0 (if not defined showfix call :dk_color %Blue% "%_fixmsg%")
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
) else (
-if /i %tsmethod%==KMS4k if %winbuild% GEQ 26200 (
+if /i %tsmethod%==KMS4k if %winbuild% GEQ 26100 (
echo:
call :dk_color %Gray% "In Windows settings, you may see a renewal notification for activation that can be ignored."
if /i %_actmethod%==Auto call :dk_color %Gray% "To avoid this notification, run the script with an internet connection to use the StaticCID method."
)
echo "%tsids%" | find /i "7e94be23-b161-4956-a682-146ab291774c" %nul1% && (
-call :dk_color %Gray% "Windows Update can receive 1-3 years of ESU. 4-6 years ESU is not officially supported, but you can manually install updates."
+call :dk_color %Gray% "Windows Update gets 1-3 years of ESU; 4-6 are unofficial but let you install Server 2008 R2 updates manually."
)
echo "%tsids%" | findstr /i "4afc620f-12a4-48ad-8015-2aebfbd6e47c 11be7019-a309-4763-9a09-091d1722ffe3" %nul1% && (
-call :dk_color %Gray% "ESU is not officially supported on Windows 8.1, but you can manually install updates until Jan-2024."
+call :dk_color %Gray% "ESU is not officially supported on Windows 8.1, but updates can be installed manually until January 2024."
)
echo "%tsids%" | findstr /i "0b533b5e-08b6-44f9-b885-c2de291ba456 f69e2d51-3bbd-4ddf-8da7-a145e9dca597" %nul1% && (
-call :dk_color %Gray% "Windows Update can receive 1-3 years of ESU. 4-6 years ESU is not officially supported, but it might be useful."
+call :dk_color %Gray% "Windows Update gets 1-3 years of ESU; 4-6 are unofficial but may let you install LTSC updates manually."
+if exist %SysPath%\ClipESUConsumer.exe (%SysPath%\ClipESUConsumer.exe -evaluateEligibility)
+if exist %SysPath%\ClipESU.exe (%SysPath%\ClipESU.exe %nul%)
)
)
+if defined esuexistsup echo Help: %mas%tsforge#windows-esu
+
if %_actwin%==1 for %%# in (407) do if %osSKU%==%%# (
call :dk_color %Red% "%winos% does not support activation on non-azure platforms."
)
@@ -11272,6 +11281,7 @@ namespace LibTSforge.PhysicalStore
$ErrorActionPreference = 'Stop'
$binPath = "$env:_work\BIN\LibTSforge.dll"
$psMajorVer = (Get-Host).Version.Major
+$build = [System.Environment]::OSVersion.Version.Build
if (Test-Path -LiteralPath $binPath) {
Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
@@ -11370,7 +11380,12 @@ if (-not $env:resetstuff) {
}
if ($env:tsmethod -eq "KMS4k") {
$GracePeriodStatus = Get-WmiInfo -tsactid $tsactid -property "GracePeriodRemaining"
- if ($GracePeriodStatus -gt 259200) { $activated = 1 }
+ if ($GracePeriodStatus -eq 259200 -or ([datetime]::Now.AddMinutes($GracePeriodStatus)).Year -gt 2038) {
+ if ((($build -ge 26100 -and $GracePeriodStatus -ge 259200) -or
+ ($build -lt 26100 -and $GracePeriodStatus -gt 259200))) {
+ $activated = 1
+ }
+ }
}
else {
$licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus"
@@ -11384,7 +11399,13 @@ if (-not $env:resetstuff) {
}
else {
if ($env:tsmethod -eq "KMS4k") {
- Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
+ if ($build -ge 26100) {
+ Write-Host "[$prodName] is activated with KMS4k for over 4,000 years." -ForegroundColor White -BackgroundColor DarkGreen
+ Write-Host "From build 26100.7019, Windows will always display and stay at 180 days remaining if the actual period is longer." -ForegroundColor White -BackgroundColor Darkgray
+ }
+ else {
+ Write-Host "[$prodName] is activated till $([DateTime]::Now.AddMinutes($GracePeriodStatus).ToString('yyyy-MM-dd HH:mm:ss')) with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
+ }
}
else {
Write-Host "[$prodName] is permanently activated with $env:tsmethod." -ForegroundColor White -BackgroundColor DarkGreen
@@ -12044,756 +12065,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
@@ -12950,8 +12221,8 @@ 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"
+set fixes=%fixes% %mas%in-place_repair_upgrade
+call :dk_color2 %Blue% "If it still shows the same error, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
)
goto dk_done
)
@@ -13069,7 +12340,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)
@@ -14644,6 +13915,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
@@ -15118,6 +14446,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
@@ -15602,6 +14971,7 @@ function DetectSubscription {
function DetectAdbaClient
{
$propADBA | foreach { set $_ (SlGetInfoSku $licID $_) }
+ DetectActType
CONOUT "`nAD Activation client information:"
CONOUT " Object Name: $ADActivationObjectName"
CONOUT " Domain Name: $ADActivationObjectDN"
@@ -15692,17 +15062,18 @@ function DetectKmsHost
if ($null -NE $KeyManagementServiceNotificationRequests) {CONOUT " Notification: $KeyManagementServiceNotificationRequests"}
}
-function DetectKmsClient
+function DetectActType
{
- if ($win8)
- {
- $VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $licID) "VLActivationType"
- if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp) "VLActivationType"}
- if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath) "VLActivationType"}
- if ($null -EQ $VLType -Or $VLType -GT 3) {$VLType = 0}
- }
+ $VLType = strGetRegistry ($SPKeyPath + '\' + $strApp + '\' + $licID) "VLActivationType"
+ if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath + '\' + $strApp) "VLActivationType"}
+ if ($null -EQ $VLType) {$VLType = strGetRegistry ($SPKeyPath) "VLActivationType"}
+ if ($null -EQ $VLType -Or $VLType -GT 3) {$VLType = 0}
if ($null -NE $VLType) {CONOUT "Configured Activation Type: $($VLActTypes[$VLType])"}
+}
+function DetectKmsClient
+{
+ if ($win8) {DetectActType}
CONOUT "`r"
if ($LicenseStatus -NE 1) {
CONOUT "Please activate the product in order to update KMS client information values."
@@ -15950,6 +15321,7 @@ function GetResult($strSLP, $strApp, $entry)
if ($win8 -And $VLActivationType -EQ 1) {
DetectAdbaClient
+ $cKmsClient = $null
}
if ($winID -And $null -NE $cAvmClient) {
@@ -16895,7 +16267,7 @@ call :dk_color %Blue% "Rebuilding ClipSVC Licenses..."
echo:
if %winbuild% LSS 10240 (
-echo ClipSVC license rebuilding is supported only on Windows 10/11 and their Server equivalents.
+echo ClipSVC license rebuilding is supported only on Windows 10/11.
echo Skipping...
goto :rebuildspptok
)
@@ -16906,6 +16278,40 @@ echo Skipping...
goto :rebuildspptok
)
+set _partial=
+set _keymatch=
+for /f "tokens=2 delims==" %%# in ('%psc% "(([WMISEARCHER]'SELECT PartialProductKey FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL AND LicenseDependsOn is NULL').Get()).PartialProductKey | %% {echo ('PartialProductKey='+$_)}" %nul6%') do set "_partial=%%#"
+for %%# in (8HV2C QPFCT 3V66T PKCKT WXCHW 8TYMD 6F4BT 8HVX7 KD72Y 7CFBY DRR8H P39PB DYJWX MDWWW 9HKR4 M7V2X 2YV77 WT2RQ MHBPB QPF8P 2YV66 VMJ2C DJ4F6 CKFFD YY74H J8JXD BHDCD T6R4W D32MH RRK69 3PJBP) do if /i "%_partial%"=="%%#" set _keymatch=1
+
+if not defined _keymatch (
+echo HWID activation key is not installed.
+echo Skipping...
+goto :rebuildspptok
+)
+
+%psc% "If([Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet){Exit 0}Else{Exit 1}"
+if errorlevel 1 (
+echo Internet is not connected.
+echo Skipping...
+goto :rebuildspptok
+)
+
+set resfail=
+for %%# in (
+licensing.mp.microsoft.com/v7.0/licenses/content
+login.live.com/ppsecure/deviceaddcredential.srf
+purchase.mp.microsoft.com/v7.0/users/me/orders
+) do if not defined resfail (
+%psc% "try { [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; irm https://%%# -Method POST } catch { if ($_.Exception.Response -eq $null) { Write-Host """"[%%#] $($_.Exception.Message)"""" -ForegroundColor Red -BackgroundColor Black; exit 3 } }"
+if !errorlevel!==3 set resfail=1
+)
+
+if defined resfail (
+echo Failed to connect to licensing servers.
+echo Skipping...
+goto :rebuildspptok
+)
+
echo Stopping ClipSVC service...
%psc% Stop-Service ClipSVC -force %nul%
timeout /t 2 %nul%
@@ -17221,8 +16627,8 @@ for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\16.0\Common\InstallRoot /v P
for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_86=Office 15.0 C2R x86" & call :getc2rrepair c2r15repair86 integratedoffice.exe)
for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\15.0\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses\ProPlus*.xrm-ms" (set "c2r15_68=Office 15.0 C2R x86/x64" & call :getc2rrepair c2r15repair68 integratedoffice.exe)
-for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & call :getc2rrepair c2r16repair86 OfficeClickToRun.exe)
-for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & call :getc2rrepair c2r16repair68 OfficeClickToRun.exe)
+for /f "skip=2 tokens=2*" %%a in ('"reg query %_86%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_86=Office 16.0 C2R x86" & call :getc2r16repair c2r16repair86 OfficeClickToRun.exe)
+for /f "skip=2 tokens=2*" %%a in ('"reg query %_68%\ClickToRun /v InstallPath" %nul6%') do if exist "%%b\root\Licenses16\ProPlus*.xrm-ms" (set "c2r16_68=Office 16.0 C2R x86/x64" & call :getc2r16repair c2r16repair68 OfficeClickToRun.exe)
set uwp16=
if %winbuild% GEQ 10240 (
@@ -17264,13 +16670,11 @@ echo ________________________________________________________________
echo:
)
-if %counter% EQU 0 (
echo:
+if %counter% EQU 0 (
echo Office ^(2010 and later^) is not installed.
goto :repairend
-echo:
-) else (
-echo:
+) else if not defined c2r16_68 if not defined c2r16_86 (
call :dk_color %_Yellow% "A new window will appear, in that window you need to select [Quick Repair] option."
if defined terminal (
call :dk_color %_Yellow% "Press [0] to continue..."
@@ -17297,16 +16701,16 @@ echo Skipping repair for Office 14.0 C2R...
echo:
)
-if defined msi14_68 if exist "%msi14repair68%" echo Running - "%msi14repair68%" & "%msi14repair68%"
-if defined msi14_86 if exist "%msi14repair86%" echo Running - "%msi14repair86%" & "%msi14repair86%"
-if defined msi15_68 if exist "%msi15repair68%" echo Running - "%msi15repair68%" & "%msi15repair68%"
-if defined msi15_86 if exist "%msi15repair86%" echo Running - "%msi15repair86%" & "%msi15repair86%"
-if defined msi16_68 if exist "%msi16repair68%" echo Running - "%msi16repair68%" & "%msi16repair68%"
-if defined msi16_86 if exist "%msi16repair86%" echo Running - "%msi16repair86%" & "%msi16repair86%"
-if defined c2r15_68 if exist "%c2r15repair68%" echo Running - "%c2r15repair68%" REPAIRUI RERUNMODE & "%c2r15repair68%" REPAIRUI RERUNMODE
-if defined c2r15_86 if exist "%c2r15repair86%" echo Running - "%c2r15repair86%" REPAIRUI RERUNMODE & "%c2r15repair86%" REPAIRUI RERUNMODE
-if defined c2r16_68 if exist "%c2r16repair68%" echo Running - "%c2r16repair68%" scenario=Repair & "%c2r16repair68%" scenario=Repair
-if defined c2r16_86 if exist "%c2r16repair86%" echo Running - "%c2r16repair86%" scenario=Repair & "%c2r16repair86%" scenario=Repair
+if defined msi14_68 if exist "%msi14repair68%" echo Running - "%msi14repair68%" & "%msi14repair68%"
+if defined msi14_86 if exist "%msi14repair86%" echo Running - "%msi14repair86%" & "%msi14repair86%"
+if defined msi15_68 if exist "%msi15repair68%" echo Running - "%msi15repair68%" & "%msi15repair68%"
+if defined msi15_86 if exist "%msi15repair86%" echo Running - "%msi15repair86%" & "%msi15repair86%"
+if defined msi16_68 if exist "%msi16repair68%" echo Running - "%msi16repair68%" & "%msi16repair68%"
+if defined msi16_86 if exist "%msi16repair86%" echo Running - "%msi16repair86%" & "%msi16repair86%"
+if defined c2r15_68 if exist "%c2r15repair68%" echo Running - "%c2r15repair68%" REPAIRUI RERUNMODE & "%c2r15repair68%" REPAIRUI RERUNMODE
+if defined c2r15_86 if exist "%c2r15repair86%" echo Running - "%c2r15repair86%" REPAIRUI RERUNMODE & "%c2r15repair86%" REPAIRUI RERUNMODE
+if defined c2r16_68 if exist "%c2r16repair68%" echo Running - "%c2r16repair68%" Scenario=Repair RepairType=QuickRepair & "%c2r16repair68%" Scenario=Repair RepairType=QuickRepair
+if defined c2r16_86 if exist "%c2r16repair86%" echo Running - "%c2r16repair86%" Scenario=Repair RepairType=QuickRepair & "%c2r16repair86%" Scenario=Repair RepairType=QuickRepair
:repairend
@@ -17326,6 +16730,13 @@ set "%1=%systemdrive%\Program Files\Microsoft Office 15\Client%%#\%2"
)
exit /b
+:getc2r16repair
+
+for %%# in (%_68% %_86%) do (
+for /f "skip=2 tokens=2*" %%a in ('"reg query %%#\ClickToRun\Configuration /v ClientFolder" %nul6%') do if exist "%%b\%2" (set "%1=%%b\%2")
+)
+exit /b
+
:getrepairsetup
set "_common86=%systemdrive%\Program Files (x86)\Common Files\Microsoft Shared\OFFICE%2\Office Setup Controller\setup.exe"
@@ -17829,8 +17240,8 @@ echo:
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"
+set fixes=%fixes% %mas%in-place_repair_upgrade
+call :dk_color2 %Blue% "If it still shows the same error, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
goto dk_done
)
)
@@ -17976,7 +17387,11 @@ echo:
for %%A in (%_ntarget%) do (
set /a counter+=1
+if /i %%A==IoTEnterprise (
+echo [!counter!] %%A [GAC, not LTSC]
+) else (
echo [!counter!] %%A
+)
set targetedition!counter!=%%A
)
@@ -18029,7 +17444,7 @@ set _dismapi=1
)
)
-set "keyflow=Retail Volume:GVLK Volume:MAK OEM:NONSLP OEM:DM PGS:TB Retail:TB:Eval"
+set "keyflow=Retail OEM:NONSLP OEM:DM Volume:MAK Volume:GVLK PGS:TB Retail:TB:Eval"
call :ced_targetSKU %targetedition%
if defined targetSKU call :ced_windowskey