mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2026-11-11 17:19:29 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cfd6f455f | ||
|
|
ccfd1eb536 | ||
|
|
cb5672904b | ||
|
|
b86cda40b2 | ||
|
|
eabab5dffb | ||
|
|
ee1a57254f | ||
|
|
ce67e9cda9 | ||
|
|
06a2ed7b34 | ||
|
|
a048798cc0 | ||
|
|
8664f12635 | ||
|
|
6b57d7c1ca | ||
|
|
b5db2e165b | ||
|
|
fc927d3738 | ||
|
|
644e0f9287 | ||
|
|
02b8d2cbc0 | ||
|
|
2780344194 | ||
|
|
6401d2f369 | ||
|
|
05c4f881ef |
No files matched your search
+4
-4
@@ -1,4 +1,4 @@
|
||||
MAS export-ignore
|
||||
LICENSE export-ignore
|
||||
README.md export-ignore
|
||||
.gitattributes export-ignore
|
||||
# MAS export-ignore
|
||||
# LICENSE export-ignore
|
||||
# README.md export-ignore
|
||||
# .gitattributes export-ignore
|
||||
@@ -3,7 +3,7 @@
|
||||
@::Is a real person even the one deciding to flag this or is it Copilot told to flag anything it decides not to like?
|
||||
@::If a campaign is using this script as a cover, please flag parts of the campaign instead of the script. This isn't the first time we experienced collateral damage due to campaigns completely unrelated to us.
|
||||
@::If you disagree that MAS is not malicious, we would appreciate if you contacted us to explain what constitutes MAS as "Sonbokli" and we'll look into it. Thank you.
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@setlocal DisableDelayedExpansion
|
||||
@echo off
|
||||
|
||||
@@ -2676,6 +2676,10 @@ if not defined winserver (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Server" %nul1% && set winserver=1
|
||||
)
|
||||
|
||||
set rdsh=
|
||||
for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v TSAppCompat 2^>nul') do set "edid=%%a"
|
||||
if "%edid%"=="0x1" set "rdsh=1"
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check Smart App Control
|
||||
@@ -2686,11 +2690,11 @@ for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\CI\P
|
||||
)
|
||||
if defined sacstate (
|
||||
if "%sacstate%"=="0x1" (
|
||||
call :dk_color %Gray% "Checking Smart App Control State [Enabled]"
|
||||
call :dk_color %Blue% "Smart App Control may prevent you from opening Office after Ohook activation."
|
||||
call :dk_color %Blue% "You will need to disable it from the Windows Defender settings if it does."
|
||||
call :dk_color %Red% "Checking Smart App Control State [Enabled]"
|
||||
call :dk_color %Blue% "Smart App Control may prevent Office from working after Ohook activation."
|
||||
call :dk_color %Blue% "It is recommended that you disable it from the Windows Defender settings."
|
||||
) else if "%sacstate%"=="0x2" (
|
||||
call :dk_color %Gray% "Checking Smart App Control State [Evaluation]"
|
||||
call :dk_color %Red% "Checking Smart App Control State [Evaluation]"
|
||||
call :dk_color %Blue% "Smart App Control may prevent you from opening Office in the future if it enables itself after the evaluation period."
|
||||
call :dk_color %Blue% "It is recommended that you disable it from the Windows Defender settings."
|
||||
)
|
||||
@@ -2725,6 +2729,9 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
|
||||
if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
|
||||
|
||||
call :oh_checkrdsh
|
||||
if defined _rdshfail goto :dk_done
|
||||
|
||||
call :oh_ppcpath
|
||||
|
||||
echo:
|
||||
@@ -2783,6 +2790,9 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
|
||||
if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
|
||||
|
||||
call :oh_checkrdsh
|
||||
if defined _rdshfail goto :dk_done
|
||||
|
||||
call :oh_ppcpath
|
||||
|
||||
echo:
|
||||
@@ -3126,6 +3136,22 @@ exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:oh_checkrdsh
|
||||
|
||||
set _rdshfail=
|
||||
if defined winserver if defined rdsh if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set error=1
|
||||
call :dk_color %Red% "Retail versions of Office cannot be activated with Ohook when running on a Remote Desktop Services host."
|
||||
call :dk_color %Blue% "Go back to Main Menu, select Change Office Edition option, and change to Volume."
|
||||
set _rdshfail=1
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Some Office Retail to Volume converter tools may edit the ProductReleaseIds to add VL products. This code restores it because it may affect features.
|
||||
|
||||
:oh_fixprids
|
||||
@@ -3414,17 +3440,6 @@ call :dk_color %_Yellow% "%mas%"
|
||||
)
|
||||
)
|
||||
|
||||
:: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server
|
||||
:: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server
|
||||
|
||||
if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set scaIsNeeded=1
|
||||
reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1%
|
||||
echo Adding SharedComputerLicensing Reg [Successful] [Needed on Server With Retail Office]"
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -4999,7 +5014,9 @@ set esuexistsup=
|
||||
set esueditionlist=
|
||||
set esuexistbutnosup=
|
||||
|
||||
if %winbuild% GTR 14393 for %%# in (EnterpriseS IoTEnterpriseS IoTEnterpriseSK) do (if /i %tsedition%==%%# set isltsc=1)
|
||||
if %winbuild% EQU 17763 for %%# in (EnterpriseS EnterpriseSN) do (if /i %tsedition%==%%# set isltsc=1)
|
||||
if %winbuild% GTR 19045 for %%# in (EnterpriseS EnterpriseSN) do (if /i %tsedition%==%%# set isltsc=1)
|
||||
if %winbuild% GEQ 19041 for %%# in (IoTEnterpriseS IoTEnterpriseSK) do (if /i %tsedition%==%%# set isltsc=1)
|
||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set isServer=1
|
||||
|
||||
if /i %tsedition%==Embedded (
|
||||
@@ -5042,13 +5059,12 @@ REM Windows10
|
||||
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
||||
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
||||
83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
||||
0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
||||
REM WindowsServer2016
|
||||
91bcac0a-d7d3-4d2b-bd0c-72fed675f01b_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
|
||||
4cd0ab30-73a4-4dde-972c-512f05be31df_Server-ESU-Year6[4-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
|
||||
REM Windows10LTSB2016
|
||||
f2571710-2c24-4677-8fb5-a07d41d3c1aa_Client-ESU-Year3[1-3y]_-EnterpriseS-EnterpriseSN-
|
||||
22badfe6-7d55-4485-874b-7ec317442134_Client-ESU-Year6[4-6y]_-EnterpriseS-EnterpriseSN-
|
||||
REM Windows10LTSC2021
|
||||
aacc1401-305e-4ba2-8110-5aae1894c880_Client-LTSC-ESU-Year3[1-3y]_-EnterpriseS-EnterpriseSN-
|
||||
) do (
|
||||
for /f "tokens=1-3 delims=_" %%A in ("%%#") do (
|
||||
echo "%allapps%" | find /i "%%A" %nul1% && (
|
||||
@@ -5057,6 +5073,7 @@ echo "%%C" | find /i "-%tsedition%%subEdition%-" %nul1% && (
|
||||
set esuexistsup=1
|
||||
set esueditionlist=
|
||||
set esuexistbutnosup=
|
||||
set esubadactids=
|
||||
set tsids=!tsids! %%A
|
||||
echo Checking Activation ID [%%A] [%%B]
|
||||
) || (
|
||||
@@ -5074,18 +5091,15 @@ call :dk_inskey "[!key!]"
|
||||
goto :ts_off
|
||||
)
|
||||
|
||||
if defined esuexistsup (
|
||||
echo "%tsids%" | find /i "4220f546-f522-46df-8202-4d07afd26454" %nul1% && (
|
||||
echo "%tsids%" | find /i "7e94be23-b161-4956-a682-146ab291774c" %nul1% || (
|
||||
call :dk_color %Gray% "To get Client-ESU-Year6[4-6y] license, install updates from the below URL."
|
||||
call :dk_color %Blue% "%mas%tsforge#windows-esu"
|
||||
)
|
||||
)
|
||||
if defined isltsc (
|
||||
call :dk_color %Gray% "Checking Activation ID [%tsedition% LTSC already has longer support, ESU is not applicable]"
|
||||
goto :ts_off
|
||||
)
|
||||
|
||||
if defined isltsc (
|
||||
call :dk_color %Gray% "Checking Activation ID [%tsedition% LTSC already has longer support, ESU is not applicable]"
|
||||
echo "%allapps%" | findstr /i "14240489-7c2d-42ee-a167-4913ca4672da b705d67e-527a-4f11-b904-7be441066a22 0b533b5e-08b6-44f9-b885-c2de291ba456 4cd0ab30-73a4-4dde-972c-512f05be31df 22badfe6-7d55-4485-874b-7ec317442134 ab8c630c-395f-4241-b08d-736fbea0e1c8" %nul1% && (
|
||||
set esuexistbutnosup=
|
||||
set esuexistsup=
|
||||
set esubadactids=1
|
||||
goto :ts_off
|
||||
)
|
||||
|
||||
@@ -5249,6 +5263,10 @@ if not defined winserver (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Server" %nul1% && set winserver=1
|
||||
)
|
||||
|
||||
set rdsh=
|
||||
for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v TSAppCompat 2^>nul') do set "edid=%%a"
|
||||
if "%edid%"=="0x1" set "rdsh=1"
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Process Office UWP
|
||||
@@ -5317,6 +5335,9 @@ set "_oLPath=%_oRoot%\Licenses"
|
||||
set "pkeypath=%_oRoot%\Office15\pkeyconfig-office.xrm-ms"
|
||||
set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
|
||||
call :ts_checkrdsh
|
||||
if defined _rdshfail goto :dk_done
|
||||
|
||||
echo:
|
||||
echo Processing Office... [C2R ^| %_version% ^| %_oArch%]
|
||||
|
||||
@@ -5359,6 +5380,9 @@ set "_oLPath=%_oRoot%\Licenses16"
|
||||
set "pkeypath=%_oRoot%\Office16\pkeyconfig-office.xrm-ms"
|
||||
set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
|
||||
call :ts_checkrdsh
|
||||
if defined _rdshfail goto :dk_done
|
||||
|
||||
echo:
|
||||
echo Processing Office... [C2R ^| %_version% %_AudienceData%^| %_oArch%]
|
||||
|
||||
@@ -5864,8 +5888,7 @@ call :dk_color %Gray% "Windows Update gets 1-3 years of ESU; 4-6 are unofficial
|
||||
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 updates can be installed manually until January 2024."
|
||||
)
|
||||
echo "%tsids%" | findstr /i "83d49986-add3-41d7-ba33-87c7bfb5c0fb 0b533b5e-08b6-44f9-b885-c2de291ba456" %nul1% && (
|
||||
call :dk_color %Gray% "Windows Update gets 1-3 years of ESU; 4-6 are unofficial but may let you install LTSC updates manually."
|
||||
echo "%tsids%" | findstr /i "f520e45e-7413-4a34-a497-d2765967d094 1043add5-23b1-4afb-9a0f-64343c8f3f8d 83d49986-add3-41d7-ba33-87c7bfb5c0fb" %nul1% && (
|
||||
if exist %SysPath%\ClipESUConsumer.exe (%SysPath%\ClipESUConsumer.exe -evaluateEligibility)
|
||||
if exist %SysPath%\ClipESU.exe (%SysPath%\ClipESU.exe %nul%)
|
||||
)
|
||||
@@ -5960,6 +5983,22 @@ exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:ts_checkrdsh
|
||||
|
||||
set _rdshfail=
|
||||
if /i not %tsmethod%==KMS4k if defined rdsh if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set error=1
|
||||
call :dk_color %Red% "Retail versions of Office cannot be activated with TSForge when running on a Remote Desktop Services host."
|
||||
call :dk_color %Blue% "Go back to Main Menu, select Change Office Edition option, and change to Volume."
|
||||
set _rdshfail=1
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:ts_process
|
||||
|
||||
if not exist "%pkeypath%" (
|
||||
@@ -6075,17 +6114,6 @@ echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
|
||||
)
|
||||
)
|
||||
|
||||
:: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server
|
||||
:: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server
|
||||
|
||||
if /i not %tsmethod%==KMS4k if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set scaIsNeeded=1
|
||||
reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1%
|
||||
echo Adding SharedComputerLicensing Reg [Successful] [Needed on Server With Retail Office]"
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -11298,6 +11326,54 @@ function slGetSkuInfo($SkuId) {
|
||||
}
|
||||
|
||||
if (-not $env:resetstuff) {
|
||||
if ($env:esubadactids) {
|
||||
$badesuactids = @(
|
||||
"14240489-7c2d-42ee-a167-4913ca4672da", # Win10 22H2 Client-ESU-Year4
|
||||
"b705d67e-527a-4f11-b904-7be441066a22", # Win10 22H2 Client-ESU-Year5
|
||||
"0b533b5e-08b6-44f9-b885-c2de291ba456", # Win10 22H2 Client-ESU-Year6
|
||||
"4cd0ab30-73a4-4dde-972c-512f05be31df", # Server 2016 Server-ESU-Year6
|
||||
"22badfe6-7d55-4485-874b-7ec317442134", # LTSB 2016 Client-ESU-Year6
|
||||
"ab8c630c-395f-4241-b08d-736fbea0e1c8" # Win10 LTSC 2021 Client-LTSC-ESU-Year6
|
||||
)
|
||||
$detected = $false
|
||||
|
||||
foreach ($eyactid in $badesuactids) {
|
||||
$licenseStatus = Get-WmiInfo -tsactid $eyactid -property "LicenseStatus"
|
||||
$prodName = Get-WmiInfo -tsactid $eyactid -property "Name"
|
||||
if ($prodName) {
|
||||
$nameParts = $prodName -split ',', 2
|
||||
$prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null }
|
||||
}
|
||||
|
||||
if ($licenseStatus -eq 1) {
|
||||
$detected = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if ($detected) {
|
||||
Write-Host "Checking Activated Licenses [Found Year 4-6 License]" -ForegroundColor White -BackgroundColor Red
|
||||
Write-Host "ESU licenses for years 4-6 prevent Windows update detection. MAS will automatically remove these licenses." -ForegroundColor White -BackgroundColor Blue
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
foreach ($eyactid in $badesuactids) {
|
||||
$licenseStatus = Get-WmiInfo -tsactid $eyactid -property "LicenseStatus"
|
||||
$prodName = Get-WmiInfo -tsactid $eyactid -property "Name"
|
||||
if ($prodName) {
|
||||
$nameParts = $prodName -split ',', 2
|
||||
$prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null }
|
||||
}
|
||||
|
||||
if ($licenseStatus -eq 1) {
|
||||
$detected = $true
|
||||
$pkeyId = [LibTSforge.SPP.SLApi]::GetInstalledPkeyID($eyactid)
|
||||
[LibTSforge.SPP.SLApi]::UninstallProductKey($pkeyId)
|
||||
Write-Host "Removed license for [$prodName]." -ForegroundColor White -BackgroundColor Darkgray
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($tsactid in $tsactids) {
|
||||
try {
|
||||
$activated = $null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@echo off
|
||||
|
||||
|
||||
@@ -598,6 +598,10 @@ if not defined winserver (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Server" %nul1% && set winserver=1
|
||||
)
|
||||
|
||||
set rdsh=
|
||||
for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v TSAppCompat 2^>nul') do set "edid=%%a"
|
||||
if "%edid%"=="0x1" set "rdsh=1"
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Check Smart App Control
|
||||
@@ -608,11 +612,11 @@ for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\CI\P
|
||||
)
|
||||
if defined sacstate (
|
||||
if "%sacstate%"=="0x1" (
|
||||
call :dk_color %Gray% "Checking Smart App Control State [Enabled]"
|
||||
call :dk_color %Blue% "Smart App Control may prevent you from opening Office after Ohook activation."
|
||||
call :dk_color %Blue% "You will need to disable it from the Windows Defender settings if it does."
|
||||
call :dk_color %Red% "Checking Smart App Control State [Enabled]"
|
||||
call :dk_color %Blue% "Smart App Control may prevent Office from working after Ohook activation."
|
||||
call :dk_color %Blue% "It is recommended that you disable it from the Windows Defender settings."
|
||||
) else if "%sacstate%"=="0x2" (
|
||||
call :dk_color %Gray% "Checking Smart App Control State [Evaluation]"
|
||||
call :dk_color %Red% "Checking Smart App Control State [Evaluation]"
|
||||
call :dk_color %Blue% "Smart App Control may prevent you from opening Office in the future if it enables itself after the evaluation period."
|
||||
call :dk_color %Blue% "It is recommended that you disable it from the Windows Defender settings."
|
||||
)
|
||||
@@ -647,6 +651,9 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
|
||||
if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
|
||||
|
||||
call :oh_checkrdsh
|
||||
if defined _rdshfail goto :dk_done
|
||||
|
||||
call :oh_ppcpath
|
||||
|
||||
echo:
|
||||
@@ -705,6 +712,9 @@ set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
if /i "%_oArch%"=="x64" (set "_hookPath=%_oRoot%\vfs\System" & set "_hook=sppc64.dll")
|
||||
if /i "%_oArch%"=="x86" (set "_hookPath=%_oRoot%\vfs\SystemX86" & set "_hook=sppc32.dll")
|
||||
|
||||
call :oh_checkrdsh
|
||||
if defined _rdshfail goto :dk_done
|
||||
|
||||
call :oh_ppcpath
|
||||
|
||||
echo:
|
||||
@@ -1046,6 +1056,23 @@ if defined _osppPath86 set _hook86=sppc32.dll
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:oh_checkrdsh
|
||||
|
||||
set _rdshfail=
|
||||
if defined winserver if defined rdsh if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set error=1
|
||||
call :dk_color %Red% "Retail versions of Office cannot be activated with Ohook when running on a Remote Desktop Services host."
|
||||
call :dk_color %Blue% "Go back to Main Menu, select Change Office Edition option, and change to Volume."
|
||||
set _rdshfail=1
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Some Office Retail to Volume converter tools may edit the ProductReleaseIds to add VL products. This code restores it because it may affect features.
|
||||
@@ -1336,17 +1363,6 @@ call :dk_color %_Yellow% "%mas%"
|
||||
)
|
||||
)
|
||||
|
||||
:: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server
|
||||
:: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server
|
||||
|
||||
if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set scaIsNeeded=1
|
||||
reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1%
|
||||
echo Adding SharedComputerLicensing Reg [Successful] [Needed on Server With Retail Office]"
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@echo off
|
||||
|
||||
|
||||
@@ -1105,7 +1105,9 @@ set esuexistsup=
|
||||
set esueditionlist=
|
||||
set esuexistbutnosup=
|
||||
|
||||
if %winbuild% GTR 14393 for %%# in (EnterpriseS IoTEnterpriseS IoTEnterpriseSK) do (if /i %tsedition%==%%# set isltsc=1)
|
||||
if %winbuild% EQU 17763 for %%# in (EnterpriseS EnterpriseSN) do (if /i %tsedition%==%%# set isltsc=1)
|
||||
if %winbuild% GTR 19045 for %%# in (EnterpriseS EnterpriseSN) do (if /i %tsedition%==%%# set isltsc=1)
|
||||
if %winbuild% GEQ 19041 for %%# in (IoTEnterpriseS IoTEnterpriseSK) do (if /i %tsedition%==%%# set isltsc=1)
|
||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" set isServer=1
|
||||
|
||||
if /i %tsedition%==Embedded (
|
||||
@@ -1148,13 +1150,12 @@ REM Windows10
|
||||
f520e45e-7413-4a34-a497-d2765967d094_Client-ESU-Year1_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
||||
1043add5-23b1-4afb-9a0f-64343c8f3f8d_Client-ESU-Year2_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
||||
83d49986-add3-41d7-ba33-87c7bfb5c0fb_Client-ESU-Year3_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
||||
0b533b5e-08b6-44f9-b885-c2de291ba456_Client-ESU-Year6[4-6y]_-%w10EsuEditions%-%w10EsuEditionsLaterAdded%
|
||||
REM WindowsServer2016
|
||||
91bcac0a-d7d3-4d2b-bd0c-72fed675f01b_Server-ESU-Year3[1-3y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
|
||||
4cd0ab30-73a4-4dde-972c-512f05be31df_Server-ESU-Year6[4-6y]_-ServerDatacenter-ServerDatacenterCore-ServerDatacenterV-ServerDatacenterVCore-ServerStandard-ServerStandardCore-ServerStandardV-ServerStandardVCore-
|
||||
REM Windows10LTSB2016
|
||||
f2571710-2c24-4677-8fb5-a07d41d3c1aa_Client-ESU-Year3[1-3y]_-EnterpriseS-EnterpriseSN-
|
||||
22badfe6-7d55-4485-874b-7ec317442134_Client-ESU-Year6[4-6y]_-EnterpriseS-EnterpriseSN-
|
||||
REM Windows10LTSC2021
|
||||
aacc1401-305e-4ba2-8110-5aae1894c880_Client-LTSC-ESU-Year3[1-3y]_-EnterpriseS-EnterpriseSN-
|
||||
) do (
|
||||
for /f "tokens=1-3 delims=_" %%A in ("%%#") do (
|
||||
echo "%allapps%" | find /i "%%A" %nul1% && (
|
||||
@@ -1163,6 +1164,7 @@ echo "%%C" | find /i "-%tsedition%%subEdition%-" %nul1% && (
|
||||
set esuexistsup=1
|
||||
set esueditionlist=
|
||||
set esuexistbutnosup=
|
||||
set esubadactids=
|
||||
set tsids=!tsids! %%A
|
||||
echo Checking Activation ID [%%A] [%%B]
|
||||
) || (
|
||||
@@ -1180,18 +1182,15 @@ call :dk_inskey "[!key!]"
|
||||
goto :ts_off
|
||||
)
|
||||
|
||||
if defined esuexistsup (
|
||||
echo "%tsids%" | find /i "4220f546-f522-46df-8202-4d07afd26454" %nul1% && (
|
||||
echo "%tsids%" | find /i "7e94be23-b161-4956-a682-146ab291774c" %nul1% || (
|
||||
call :dk_color %Gray% "To get Client-ESU-Year6[4-6y] license, install updates from the below URL."
|
||||
call :dk_color %Blue% "%mas%tsforge#windows-esu"
|
||||
)
|
||||
)
|
||||
if defined isltsc (
|
||||
call :dk_color %Gray% "Checking Activation ID [%tsedition% LTSC already has longer support, ESU is not applicable]"
|
||||
goto :ts_off
|
||||
)
|
||||
|
||||
if defined isltsc (
|
||||
call :dk_color %Gray% "Checking Activation ID [%tsedition% LTSC already has longer support, ESU is not applicable]"
|
||||
echo "%allapps%" | findstr /i "14240489-7c2d-42ee-a167-4913ca4672da b705d67e-527a-4f11-b904-7be441066a22 0b533b5e-08b6-44f9-b885-c2de291ba456 4cd0ab30-73a4-4dde-972c-512f05be31df 22badfe6-7d55-4485-874b-7ec317442134 ab8c630c-395f-4241-b08d-736fbea0e1c8" %nul1% && (
|
||||
set esuexistbutnosup=
|
||||
set esuexistsup=
|
||||
set esubadactids=1
|
||||
goto :ts_off
|
||||
)
|
||||
|
||||
@@ -1355,6 +1354,10 @@ if not defined winserver (
|
||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Server" %nul1% && set winserver=1
|
||||
)
|
||||
|
||||
set rdsh=
|
||||
for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v TSAppCompat 2^>nul') do set "edid=%%a"
|
||||
if "%edid%"=="0x1" set "rdsh=1"
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:: Process Office UWP
|
||||
@@ -1423,6 +1426,9 @@ set "_oLPath=%_oRoot%\Licenses"
|
||||
set "pkeypath=%_oRoot%\Office15\pkeyconfig-office.xrm-ms"
|
||||
set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
|
||||
call :ts_checkrdsh
|
||||
if defined _rdshfail goto :dk_done
|
||||
|
||||
echo:
|
||||
echo Processing Office... [C2R ^| %_version% ^| %_oArch%]
|
||||
|
||||
@@ -1465,6 +1471,9 @@ set "_oLPath=%_oRoot%\Licenses16"
|
||||
set "pkeypath=%_oRoot%\Office16\pkeyconfig-office.xrm-ms"
|
||||
set "_oIntegrator=%_oRoot%\integration\integrator.exe"
|
||||
|
||||
call :ts_checkrdsh
|
||||
if defined _rdshfail goto :dk_done
|
||||
|
||||
echo:
|
||||
echo Processing Office... [C2R ^| %_version% %_AudienceData%^| %_oArch%]
|
||||
|
||||
@@ -1970,8 +1979,7 @@ call :dk_color %Gray% "Windows Update gets 1-3 years of ESU; 4-6 are unofficial
|
||||
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 updates can be installed manually until January 2024."
|
||||
)
|
||||
echo "%tsids%" | findstr /i "83d49986-add3-41d7-ba33-87c7bfb5c0fb 0b533b5e-08b6-44f9-b885-c2de291ba456" %nul1% && (
|
||||
call :dk_color %Gray% "Windows Update gets 1-3 years of ESU; 4-6 are unofficial but may let you install LTSC updates manually."
|
||||
echo "%tsids%" | findstr /i "f520e45e-7413-4a34-a497-d2765967d094 1043add5-23b1-4afb-9a0f-64343c8f3f8d 83d49986-add3-41d7-ba33-87c7bfb5c0fb" %nul1% && (
|
||||
if exist %SysPath%\ClipESUConsumer.exe (%SysPath%\ClipESUConsumer.exe -evaluateEligibility)
|
||||
if exist %SysPath%\ClipESU.exe (%SysPath%\ClipESU.exe %nul%)
|
||||
)
|
||||
@@ -2148,6 +2156,22 @@ exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:ts_checkrdsh
|
||||
|
||||
set _rdshfail=
|
||||
if /i not %tsmethod%==KMS4k if defined rdsh if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set error=1
|
||||
call :dk_color %Red% "Retail versions of Office cannot be activated with TSForge when running on a Remote Desktop Services host."
|
||||
call :dk_color %Blue% "Go back to Main Menu, select Change Office Edition option, and change to Volume."
|
||||
set _rdshfail=1
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:ts_process
|
||||
|
||||
if not exist "%pkeypath%" (
|
||||
@@ -2263,17 +2287,6 @@ echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
|
||||
)
|
||||
)
|
||||
|
||||
:: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server
|
||||
:: https://learn.microsoft.com/en-us/office/troubleshoot/office-suite-issues/click-to-run-office-on-terminal-server
|
||||
|
||||
if /i not %tsmethod%==KMS4k if defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||
set scaIsNeeded=1
|
||||
reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1%
|
||||
echo Adding SharedComputerLicensing Reg [Successful] [Needed on Server With Retail Office]"
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
|
||||
::========================================================================================================================================
|
||||
@@ -8897,6 +8910,54 @@ function slGetSkuInfo($SkuId) {
|
||||
}
|
||||
|
||||
if (-not $env:resetstuff) {
|
||||
if ($env:esubadactids) {
|
||||
$badesuactids = @(
|
||||
"14240489-7c2d-42ee-a167-4913ca4672da", # Win10 22H2 Client-ESU-Year4
|
||||
"b705d67e-527a-4f11-b904-7be441066a22", # Win10 22H2 Client-ESU-Year5
|
||||
"0b533b5e-08b6-44f9-b885-c2de291ba456", # Win10 22H2 Client-ESU-Year6
|
||||
"4cd0ab30-73a4-4dde-972c-512f05be31df", # Server 2016 Server-ESU-Year6
|
||||
"22badfe6-7d55-4485-874b-7ec317442134", # LTSB 2016 Client-ESU-Year6
|
||||
"ab8c630c-395f-4241-b08d-736fbea0e1c8" # Win10 LTSC 2021 Client-LTSC-ESU-Year6
|
||||
)
|
||||
$detected = $false
|
||||
|
||||
foreach ($eyactid in $badesuactids) {
|
||||
$licenseStatus = Get-WmiInfo -tsactid $eyactid -property "LicenseStatus"
|
||||
$prodName = Get-WmiInfo -tsactid $eyactid -property "Name"
|
||||
if ($prodName) {
|
||||
$nameParts = $prodName -split ',', 2
|
||||
$prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null }
|
||||
}
|
||||
|
||||
if ($licenseStatus -eq 1) {
|
||||
$detected = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if ($detected) {
|
||||
Write-Host "Checking Activated Licenses [Found Year 4-6 License]" -ForegroundColor White -BackgroundColor Red
|
||||
Write-Host "ESU licenses for years 4-6 prevent Windows update detection. MAS will automatically remove these licenses." -ForegroundColor White -BackgroundColor Blue
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
foreach ($eyactid in $badesuactids) {
|
||||
$licenseStatus = Get-WmiInfo -tsactid $eyactid -property "LicenseStatus"
|
||||
$prodName = Get-WmiInfo -tsactid $eyactid -property "Name"
|
||||
if ($prodName) {
|
||||
$nameParts = $prodName -split ',', 2
|
||||
$prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null }
|
||||
}
|
||||
|
||||
if ($licenseStatus -eq 1) {
|
||||
$detected = $true
|
||||
$pkeyId = [LibTSforge.SPP.SLApi]::GetInstalledPkeyID($eyactid)
|
||||
[LibTSforge.SPP.SLApi]::UninstallProductKey($pkeyId)
|
||||
Write-Host "Removed license for [$prodName]." -ForegroundColor White -BackgroundColor Darkgray
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($tsactid in $tsactids) {
|
||||
try {
|
||||
$activated = $null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@set masver=3.12
|
||||
@set masver=3.14
|
||||
@echo off
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user