mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2026-09-11 22:55:24 +08:00
Disable Office retail activation for RDS hosts
This commit is contained in:
@@ -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
|
||||
@@ -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,19 +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
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
:oh_processmsi
|
||||
@@ -5249,6 +5262,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 +5334,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 +5379,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%]
|
||||
|
||||
@@ -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
|
||||
|
||||
::========================================================================================================================================
|
||||
|
||||
Reference in New Issue
Block a user