mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2024-11-14 12:58:43 +01:00
Detect a potential script crash when user installs too many licenses for Office
This commit is contained in:
parent
0b402d9afe
commit
873c4bc4d8
3 changed files with 48 additions and 0 deletions
|
@ -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 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%')"
|
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"))
|
%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
|
exit /b
|
||||||
|
|
||||||
:: Get installed products Activation IDs
|
:: Get installed products Activation IDs
|
||||||
|
|
|
@ -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 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%')"
|
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"))
|
%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
|
exit /b
|
||||||
|
|
||||||
:: Get installed products Activation IDs
|
:: Get installed products Activation IDs
|
||||||
|
|
|
@ -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 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%')"
|
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"))
|
%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
|
exit /b
|
||||||
|
|
||||||
:: Get installed products Activation IDs
|
:: Get installed products Activation IDs
|
||||||
|
|
Loading…
Reference in a new issue