From 873c4bc4d8fb735e100116782b63f4dd54c355f7 Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Sat, 9 Nov 2024 20:35:41 +0530 Subject: [PATCH] Detect a potential script crash when user installs too many licenses for Office --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 16 ++++++++++++++++ .../Activators/Ohook_Activation_AIO.cmd | 16 ++++++++++++++++ .../Activators/Online_KMS_Activation.cmd | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index a28b638..dd6d6f6 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -1162,6 +1162,22 @@ set allapps= if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')" if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')" %chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a")) + +:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable) + +if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 ( +set len=0 +echo:!allapps!> %SystemRoot%\Temp\chklen +for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA) +del %SystemRoot%\Temp\chklen %nul% + +if !len! GTR 6000 ( +%eline% +echo Too many licenses are installed, the script may crash. +call :dk_color %Blue% "%_fixmsg%" +timeout /t 30 +) +) exit /b :: Get installed products Activation IDs diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index d15ede9..da88ed9 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -1455,6 +1455,22 @@ set allapps= if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')" if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')" %chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a")) + +:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable) + +if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 ( +set len=0 +echo:!allapps!> %SystemRoot%\Temp\chklen +for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA) +del %SystemRoot%\Temp\chklen %nul% + +if !len! GTR 6000 ( +%eline% +echo Too many licenses are installed, the script may crash. +call :dk_color %Blue% "%_fixmsg%" +timeout /t 30 +) +) exit /b :: Get installed products Activation IDs diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 9c78cfa..28d22e3 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -2479,6 +2479,22 @@ set allapps= if %_wmic% EQU 1 set "chkapp=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='%1') get ID /VALUE" %nul6%')" if %_wmic% EQU 0 set "chkapp=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT ID FROM %spp% WHERE ApplicationID=''%1''').Get()).ID ^| %% {echo ('ID='+$_)}" %nul6%')" %chkapp% do (if defined allapps (call set "allapps=!allapps! %%a") else (call set "allapps=%%a")) + +:: Check potential script crash issue when user manually installs way too many licenses for Office (length limit in variable) + +if defined allapps if %1==0ff1ce15-a989-479d-af46-f275c6370663 ( +set len=0 +echo:!allapps!> %SystemRoot%\Temp\chklen +for %%A in (%SystemRoot%\Temp\chklen) do (set len=%%~zA) +del %SystemRoot%\Temp\chklen %nul% + +if !len! GTR 6000 ( +%eline% +echo Too many licenses are installed, the script may crash. +call :dk_color %Blue% "%_fixmsg%" +timeout /t 30 +) +) exit /b :: Get installed products Activation IDs