Compare commits

..

No commits in common. "5f5a51322d35aa3dae58cde5edb70e324cbf0ad8" and "63b3c5097b5acbd1f6fa35a4483d585cac35ae17" have entirely different histories.

5 changed files with 86 additions and 215 deletions

View File

@ -1084,11 +1084,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corru
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]" if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
sc start sppsvc %nul% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
set "results=%results%[Likely File Infector]"
) || (
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
)
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"

View File

@ -1227,11 +1227,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corru
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]" if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
sc start sppsvc %nul% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
set "results=%results%[Likely File Infector]"
) || (
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
)
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"

View File

@ -1534,11 +1534,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corru
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]" if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
sc start sppsvc %nul% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
set "results=%results%[Likely File Infector]"
) || (
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
)
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"

View File

@ -602,28 +602,6 @@ if not %_actoff%==1 goto :ks_activate
call :ks_setspp call :ks_setspp
:: Check ohook install
set ohook=
for %%# in (15 16) do (
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" set ohook=1
)
)
for %%# in (System SystemX86) do (
for %%G in ("Office 15" "Office") do (
for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" set ohook=1
)
)
)
if defined ohook (
echo:
call :dk_color %Gray% "Checking Ohook [Ohook activation is already installed for Office]"
)
:: Check unsupported office versions :: Check unsupported office versions
set o14c2r= set o14c2r=
@ -827,6 +805,7 @@ call :_taskregserv
) )
call :_taskact call :_taskact
if defined sppoid if not defined _tserror if %_NoEditionChange%==0 if defined ohub call :dk_color %Gray% "Office apps such as Word, Excel are activated, use them directly. Ignore 'Buy' button in Office dashboard app."
if not defined showfix if defined _tserror (call :dk_color %Blue% "%_fixmsg%" & set showfix=1) if not defined showfix if defined _tserror (call :dk_color %Blue% "%_fixmsg%" & set showfix=1)
:: Don't create renewal task if Windows/Office volume IDs are not found, even if script is set to create it by default :: Don't create renewal task if Windows/Office volume IDs are not found, even if script is set to create it by default
@ -847,7 +826,7 @@ if not defined _deltask (
call :ks_renewal call :ks_renewal
) else ( ) else (
if exist "%ProgramFiles%\Activation-Renewal\Activation_task.cmd" call :dk_color %Gray% "Deleting activation renewal task..." if exist "%ProgramFiles%\Activation-Renewal\Activation_task.cmd" call :dk_color %Gray% "Deleting activation renewal task..."
call :dk_color %Gray% "Skipping creation of activation renewal task..." call :dk_color %Gray% "Skipping to create activation renewal task..."
call :ks_clearstuff %nul% call :ks_clearstuff %nul%
if not defined _server ( if not defined _server (
if %winbuild% GEQ 9200 ( if %winbuild% GEQ 9200 (
@ -873,11 +852,6 @@ if %_actwin%==1 for %%# in (407) do if %osSKU%==%%# (
call :dk_color %Red% "%winos% does not support activation on non-azure platforms." call :dk_color %Red% "%winos% does not support activation on non-azure platforms."
) )
if %_actoff%==1 if defined sppoid if not defined _tserror if %_NoEditionChange%==0 if defined ohub (
echo:
call :dk_color %Gray% "Office apps such as Word, Excel are activated, use them directly. Ignore 'Buy' button in Office dashboard app."
)
:: Trigger reevaluation of SPP's Scheduled Tasks :: Trigger reevaluation of SPP's Scheduled Tasks
call :dk_reeval %nul% call :dk_reeval %nul%
@ -2583,11 +2557,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corru
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]" if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
sc start sppsvc %nul% sc start sppsvc %nul%
echo "%errorlevel%" | findstr "577 225" %nul% && ( echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
set "results=%results%[Likely File Infector]"
) || (
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
)
if not "%results%%pupfound%"=="" ( if not "%results%%pupfound%"=="" (
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]" if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"

View File

@ -1,12 +1,15 @@
@set masver=2.6 @set masver=2.6
@setlocal DisableDelayedExpansion
@echo off @echo off
::============================================================================ ::============================================================================
:: ::
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
::
:: Homepage: mass grave[.]dev :: Homepage: mass grave[.]dev
:: Email: mas.help@outlook.com :: Email: windowsaddict@protonmail.com
:: ::
::============================================================================ ::============================================================================
@ -14,31 +17,25 @@
::======================================================================================================================================== ::========================================================================================================================================
:: Set Environment variables, it helps if they are misconfigured in the system :: Set Path variable, it helps if it is misconfigured in the system
setlocal EnableExtensions set "PATH=%SystemRoot%\System32;%SystemRoot%\System32\wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
setlocal DisableDelayedExpansion
set "PathExt=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
set "SysPath=%SystemRoot%\System32"
set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
if exist "%SystemRoot%\Sysnative\reg.exe" ( if exist "%SystemRoot%\Sysnative\reg.exe" (
set "SysPath=%SystemRoot%\Sysnative" set "PATH=%SystemRoot%\Sysnative;%SystemRoot%\Sysnative\wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%PATH%"
set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
) )
set "ComSpec=%SysPath%\cmd.exe" :: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules" :: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
set "_cmdf=%~f0" set "_cmdf=%~f0"
for %%# in (%*) do ( for %%# in (%*) do (
if /i "%%#"=="r1" set r1=1 if /i "%%#"=="r1" set r1=1
if /i "%%#"=="r2" set r2=1 if /i "%%#"=="r2" set r2=1
if /i "%%#"=="-qedit" (
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d "1" /f %nul1%
rem check the code below admin elevation to understand why it's here
)
) )
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 ( if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
@ -67,10 +64,10 @@ echo:
echo Null service is not running, script may crash... echo Null service is not running, script may crash...
echo: echo:
echo: echo:
echo Help - %mas%troubleshoot echo Help - %mas%troubleshoot.html
echo: echo:
echo: echo:
ping 127.0.0.1 -n 20 ping 127.0.0.1 -n 10
) )
cls cls
@ -79,13 +76,9 @@ cls
pushd "%~dp0" pushd "%~dp0"
>nul findstr /v "$" "%~nx0" && ( >nul findstr /v "$" "%~nx0" && (
echo: echo:
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing. echo Error: Script either has LF line ending issue or an empty line at the end of the script is missing.
echo: echo:
echo: ping 127.0.0.1 -n 6 >nul
echo Help - %mas%troubleshoot
echo:
echo:
ping 127.0.0.1 -n 20 >nul
popd popd
exit /b exit /b
) )
@ -99,7 +92,6 @@ title Extract $OEM$ Folder %masver%
set _args= set _args=
set _elev= set _elev=
set _unattended=0
set _args=%* set _args=%*
if defined _args set _args=%_args:"=% if defined _args set _args=%_args:"=%
@ -114,7 +106,35 @@ set "nul2=2>nul"
set "nul6=2^>nul" set "nul6=2^>nul"
set "nul=>nul 2>&1" set "nul=>nul 2>&1"
call :dk_setvar set psc=powershell.exe
set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "_White="40;37m""
set "_Green="40;92m""
set "_Yellow="40;93m""
) else (
set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "_White="Black" "Gray""
set "_Green="Black" "Green""
set "_Yellow="Black" "Yellow""
)
set "nceline=echo: &echo ==== ERROR ==== &echo:"
set "eline=echo: &call :ex_color %Red% "==== ERROR ====" &echo:"
::======================================================================================================================================== ::========================================================================================================================================
@ -125,6 +145,12 @@ echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equiva
goto done2 goto done2
) )
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" (
%nceline%
echo Unable to find powershell.exe in the system.
goto done2
)
::======================================================================================================================================== ::========================================================================================================================================
:: Fix special characters limitation in path name :: Fix special characters limitation in path name
@ -136,8 +162,6 @@ set "_batf=%~f0"
set "_batp=%_batf:'=''%" set "_batp=%_batf:'=''%"
set _PSarg="""%~f0""" -el %_args% set _PSarg="""%~f0""" -el %_args%
set _PSarg=%_PSarg:'=''%
set "_ttemp=%userprofile%\AppData\Local\Temp" set "_ttemp=%userprofile%\AppData\Local\Temp"
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
@ -157,36 +181,10 @@ goto done2
::======================================================================================================================================== ::========================================================================================================================================
:: Check PowerShell
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
%eline%
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
echo:
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
echo Failed to run Powershell command but Powershell is working.
call :dk_color %Blue% "Check if your antivirus is blocking the script."
echo:
set fixes=%fixes% %mas%troubleshoot
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
) || (
echo PowerShell is not working. Aborting...
echo If you have applied restrictions on Powershell then undo those changes.
echo:
set fixes=%fixes% %mas%fix_powershell
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell"
)
goto done2
)
::========================================================================================================================================
:: Elevate script as admin and pass arguments and preventing loop :: Elevate script as admin and pass arguments and preventing loop
%nul1% fltmc || ( %nul1% fltmc || (
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
%eline% %eline%
echo This script needs admin rights. echo This script needs admin rights.
echo To do so, right click on this script and select 'Run as administrator'. echo To do so, right click on this script and select 'Run as administrator'.
@ -195,45 +193,18 @@ goto done2
::======================================================================================================================================== ::========================================================================================================================================
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app :: This code disables QuickEdit for this cmd.exe session only without making permanent changes to the registry
:: It is added because clicking on the script window pauses the operation and leads to the confusion that script stopped due to an error
if %winbuild% GEQ 17763 ( for %%# in (%_args%) do (if /i "%%#"=="-qedit" set quedit=1)
set terminal=1
) else ( reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% || if not defined quedit (
set terminal= reg add HKCU\Console /v QuickEdit /t REG_DWORD /d "0" /f %nul1%
start cmd.exe /c ""!_batf!" %_args% -qedit"
rem quickedit reset code is added at the starting of the script instead of here because it takes time to reflect in some cases
exit /b
) )
:: Check if script is running in Terminal app
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128);
set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128);
set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow();
set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero);
if defined terminal (
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
)
if %_unattended%==1 goto :skipQE
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
if defined terminal (
set "launchcmd=start conhost.exe %psc%"
) else (
set "launchcmd=%psc%"
)
:: Disable QuickEdit in current session
set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);"
set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);"
set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);"
set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);"
%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1)
:skipQE
::======================================================================================================================================== ::========================================================================================================================================
:: Check for updates :: Check for updates
@ -248,19 +219,18 @@ if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.6
if defined old ( if defined old (
echo ________________________________________________ echo ________________________________________________
%eline% %eline%
echo Version %masver% of MAS is outdated. echo You are running outdated version MAS %masver%
echo ________________________________________________ echo ________________________________________________
echo: echo:
if not %_unattended%==1 (
echo [1] Get Latest MAS echo [1] Get Latest MAS
echo [0] Continue Anyway echo [0] Continue Anyway
echo: echo:
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :" call :ex_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
choice /C:10 /N choice /C:10 /N
if !errorlevel!==2 rem if !errorlevel!==2 rem
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b) if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
) )
) cls
::======================================================================================================================================== ::========================================================================================================================================
@ -285,7 +255,7 @@ setlocal EnableDelayedExpansion
::======================================================================================================================================== ::========================================================================================================================================
if not defined terminal mode 78, 30 mode con cols=78 lines=30
if exist "!desktop!\$OEM$\" ( if exist "!desktop!\$OEM$\" (
echo _____________________________________________________ echo _____________________________________________________
@ -326,7 +296,7 @@ goto done2
:Menu :Menu
cls cls
if not defined terminal mode 78, 30 mode con cols=78 lines=30
echo: echo:
echo: echo:
echo: echo:
@ -345,16 +315,16 @@ echo: [7] KMS38 ^(Windows^) ^+ Ohook ^(Office^)
echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^) echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^)
echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^) echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^)
echo: echo:
call :dk_color2 %_White% " [R] " %_Green% "ReadMe" call :ex_color2 %_White% " [R] " %_Green% "ReadMe"
echo: [0] Exit echo: [0] Exit
echo: ________________________________________________________ echo: ________________________________________________________
echo: echo:
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard :" call :ex_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard :"
choice /C:123456789R0 /N choice /C:123456789R0 /N
set _erl=%errorlevel% set _erl=%errorlevel%
if %_erl%==11 exit /b if %_erl%==11 exit /b
if %_erl%==10 start %mas%oem-folder &goto :Menu if %_erl%==10 start %mas%oem-folder.html &goto :Menu
if %_erl%==9 goto:kms_ohook if %_erl%==9 goto:kms_ohook
if %_erl%==8 goto:kms38_kms if %_erl%==8 goto:kms38_kms
if %_erl%==7 goto:kms38_ohook if %_erl%==7 goto:kms38_ohook
@ -480,7 +450,7 @@ goto done
fltmc >nul || exit /b fltmc >nul || exit /b
call "%~dp0Online_KMS_Activation.cmd" /K-WindowsOffice call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-WindowsOffice
cd \ cd \
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0") (goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
@ -555,7 +525,7 @@ call "%~dp0HWID_Activation.cmd" /HWID
endlocal endlocal
setlocal setlocal
call "%~dp0Online_KMS_Activation.cmd" /K-Office call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
endlocal endlocal
cd \ cd \
@ -631,7 +601,7 @@ call "%~dp0KMS38_Activation.cmd" /KMS38
endlocal endlocal
setlocal setlocal
call "%~dp0Online_KMS_Activation.cmd" /K-Office call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
endlocal endlocal
cd \ cd \
@ -665,7 +635,7 @@ goto done
fltmc >nul || exit /b fltmc >nul || exit /b
setlocal setlocal
call "%~dp0Online_KMS_Activation.cmd" /K-Windows call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Windows
endlocal endlocal
setlocal setlocal
@ -688,8 +658,8 @@ goto :done2
echo ______________________________________________________________ echo ______________________________________________________________
echo: echo:
call :dk_color %Blue% "%oem%" call :ex_color %Blue% "%oem%"
call :dk_color %Green% "$OEM$ folder is successfully created on the Desktop." call :ex_color %Green% "$OEM$ folder is successfully created on the Desktop."
echo "%oem%" | find /i "38" %nul% && ( echo "%oem%" | find /i "38" %nul% && (
echo: echo:
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^), echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
@ -700,65 +670,8 @@ echo ______________________________________________________________
:done2 :done2
echo: echo:
if defined fixes ( call :ex_color %_Yellow% "Press any key to exit..."
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
choice /C:10 /N
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
)
if defined terminal (
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
choice /c 0 /n
) else (
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
pause %nul1% pause %nul1%
)
exit /b
::========================================================================================================================================
:: Set variables
:dk_setvar
set psc=powershell.exe
set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
set _NCS=1
if %winbuild% LSS 10586 set _NCS=0
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
if %_NCS% EQU 1 (
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
set "Red="41;97m""
set "Gray="100;97m""
set "Green="42;97m""
set "Blue="44;97m""
set "_Red="40;91m""
set "_White="40;37m""
set "_Green="40;92m""
set "_Yellow="40;93m""
) else (
set "Red="Red" "white""
set "Gray="Darkgray" "white""
set "Green="DarkGreen" "white""
set "Blue="Blue" "white""
set "_Red="Black" "Red""
set "_White="Black" "Gray""
set "_Green="Black" "Green""
set "_Yellow="Black" "Yellow""
)
set "nceline=echo: &echo ==== ERROR ==== &echo:"
set "eline=echo: &call :dk_color %Red% "==== ERROR ====" &echo:"
if %~z0 GEQ 200000 (
set "_exitmsg=Go back"
set "_fixmsg=Go back to Main Menu, select Troubleshoot and run Fix Licensing option."
) else (
set "_exitmsg=Exit"
set "_fixmsg=In MAS folder, run Troubleshoot script and select Fix Licensing option."
)
exit /b exit /b
::======================================================================================================================================== ::========================================================================================================================================
@ -772,7 +685,7 @@ exit /b
::======================================================================================================================================== ::========================================================================================================================================
:dk_color :ex_color
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (
echo %esc%[%~1%~2%esc%[0m echo %esc%[%~1%~2%esc%[0m
@ -781,7 +694,7 @@ if not exist %psc% (echo %~3) else (%psc% write-host -back '%1' -fore '%2' '%3')
) )
exit /b exit /b
:dk_color2 :ex_color2
if %_NCS% EQU 1 ( if %_NCS% EQU 1 (
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m