mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts
synced 2026-02-05 15:30:09 +00:00
Compare commits
25 Commits
3.0
...
172fd7b1c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
172fd7b1c5 | ||
|
|
372eb73a02 | ||
|
|
a1614e1283 | ||
|
|
e8bf344f74 | ||
|
|
70162c4130 | ||
|
|
294837dfe0 | ||
|
|
f5a0a63165 | ||
|
|
0d61475468 | ||
|
|
c316b42e5c | ||
|
|
3b739d7e2b | ||
|
|
8673fbbfda | ||
|
|
60dd549a49 | ||
|
|
1e3c0aaedf | ||
|
|
fe001e6c39 | ||
|
|
c4f33e96c4 | ||
|
|
69f1a206fb | ||
|
|
ab0cd24f89 | ||
|
|
55afa30fcd | ||
|
|
5e7e42a446 | ||
|
|
a9eda8f572 | ||
|
|
a5bcfdd3e6 | ||
|
|
8d67d62c15 | ||
|
|
6adb247334 | ||
|
|
6c8732dd06 | ||
|
|
9765e7d05f |
6
.gitattributes
vendored
6
.gitattributes
vendored
@@ -1,4 +1,4 @@
|
|||||||
MAS export-ignore
|
# MAS export-ignore
|
||||||
LICENSE export-ignore
|
# LICENSE export-ignore
|
||||||
README.md export-ignore
|
# README.md export-ignore
|
||||||
.gitattributes export-ignore
|
.gitattributes export-ignore
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -109,7 +109,7 @@ 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%fix_service
|
echo Check this webpage for help - %mas%fix_service
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20
|
ping 127.0.0.1 -n 20
|
||||||
@@ -124,7 +124,7 @@ 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:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
@@ -167,7 +167,7 @@ echo Failed to detect Windows build number.
|
|||||||
echo:
|
echo:
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -219,33 +219,6 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
|
||||||
|
|
||||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
|
|
||||||
echo:
|
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
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 dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
@@ -258,6 +231,58 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
|
%eline%
|
||||||
|
echo: %tstresult%
|
||||||
|
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||||
|
|
||||||
|
REM check LanguageMode
|
||||||
|
|
||||||
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%fix_powershell
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check Powershell core version
|
||||||
|
|
||||||
|
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||||
|
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check for Mal-ware that may cause issues with Powershell
|
||||||
|
|
||||||
|
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||||
|
echo "%%f"
|
||||||
|
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check antivirus and other errors
|
||||||
|
|
||||||
|
echo PowerShell is not working properly. Aborting...
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
@@ -268,34 +293,33 @@ set terminal=
|
|||||||
|
|
||||||
:: Check if script is running in Terminal app
|
:: 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 (
|
if defined terminal (
|
||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
set lines=0
|
||||||
|
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||||
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined ps32onArm goto :skipQE
|
|
||||||
if %_unattended%==1 goto :skipQE
|
if %_unattended%==1 goto :skipQE
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||||
|
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||||
|
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||||
|
|
||||||
|
set resetQE=1
|
||||||
|
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||||
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set "launchcmd=start conhost.exe %psc%"
|
start conhost.exe "!_batf!" %_args% -qedit
|
||||||
) else (
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
set "launchcmd=%psc%"
|
exit /b
|
||||||
|
) else if %resetQE% EQU 1 (
|
||||||
|
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||||
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 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
|
:skipQE
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -304,12 +328,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
|||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
set pingp=
|
||||||
set upver=%masver:.=%
|
set upver=%masver:.=%
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
|
for %%A in (
|
||||||
if not "%%#"=="" set old=1
|
activ%-%ated.win
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
|
mass%-%grave.dev
|
||||||
if not "%%#"=="" set old=
|
) do if not defined pingp (
|
||||||
|
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||||
|
if not "%%B"=="" (set old=1& set pingp=1)
|
||||||
|
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||||
|
if not "%%C"=="" set old=
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -352,7 +382,7 @@ if not exist %SysPath%\%%# (
|
|||||||
echo [%SysPath%\%%#] file is missing, aborting...
|
echo [%SysPath%\%%#] file is missing, aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -398,7 +428,7 @@ echo Evaluation editions cannot be activated outside of their evaluation period.
|
|||||||
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
|
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%evaluation_editions
|
set fixes=%fixes% %mas%evaluation_editions
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -485,7 +515,7 @@ echo %mas%
|
|||||||
) else (
|
) else (
|
||||||
echo Required license files not found in %SysPath%\spp\tokens\skus\
|
echo Required license files not found in %SysPath%\spp\tokens\skus\
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
echo:
|
echo:
|
||||||
goto dk_done
|
goto dk_done
|
||||||
@@ -664,7 +694,7 @@ findstr /i "%%#" "%SysPath%\drivers\etc\hosts" %nul1% && set "hosfail= [%%# Bloc
|
|||||||
)
|
)
|
||||||
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]!hosfail!"
|
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]!hosfail!"
|
||||||
set fixes=%fixes% %mas%licensing-servers-issue
|
set fixes=%fixes% %mas%licensing-servers-issue
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%licensing-servers-issue"
|
||||||
)
|
)
|
||||||
|
|
||||||
::==========================================================================================================================================
|
::==========================================================================================================================================
|
||||||
@@ -701,7 +731,7 @@ call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]
|
|||||||
if !wcount! GTR 2 (
|
if !wcount! GTR 2 (
|
||||||
call :dk_color %Red% "Windows seems to be infected with Mal%w%ware."
|
call :dk_color %Red% "Windows seems to be infected with Mal%w%ware."
|
||||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it."
|
call :dk_color %Blue% "HWID activation needs working Windows updates, if you have used any tool to block updates, undo it."
|
||||||
)
|
)
|
||||||
@@ -726,7 +756,7 @@ if not defined wucorrupt if not defined wublock if not defined wuerror if not de
|
|||||||
echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && (
|
echo "%error_code%" | findstr /i "0x80072e 0x80072f 0x800704cf 0x87e10bcf 0x800705b4" %nul% && (
|
||||||
call :dk_color %Red% "Checking Internet Issues [Found] %error_code%"
|
call :dk_color %Red% "Checking Internet Issues [Found] %error_code%"
|
||||||
set fixes=%fixes% %mas%licensing-servers-issue
|
set fixes=%fixes% %mas%licensing-servers-issue
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%licensing-servers-issue"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%licensing-servers-issue"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -744,7 +774,7 @@ call :dk_color %Blue% "Use TSforge activation option from the main menu instead.
|
|||||||
) else (
|
) else (
|
||||||
if not defined error call :dk_color %Blue% "%_fixmsg%"
|
if not defined error call :dk_color %Blue% "%_fixmsg%"
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -778,7 +808,7 @@ goto :dk_done
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
@@ -1050,7 +1080,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||||
@@ -1126,7 +1156,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators
|
|||||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||||
if defined results call :dk_color %Red% "%results%"
|
if defined results call :dk_color %Red% "%results%"
|
||||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1246,7 +1276,7 @@ set showfix=1
|
|||||||
)
|
)
|
||||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
||||||
set fixes=%fixes% %mas%fix_service
|
set fixes=%fixes% %mas%fix_service
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1303,7 +1333,7 @@ if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
|
|||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||||
set fixes=%fixes% %mas%evaluation_editions
|
set fixes=%fixes% %mas%evaluation_editions
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1433,7 +1463,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
|
|||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
@@ -1448,7 +1478,7 @@ set error=1
|
|||||||
set showfix=1
|
set showfix=1
|
||||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -1573,7 +1603,7 @@ exit /b
|
|||||||
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
||||||
$count = 0
|
$count = 0
|
||||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
$count++
|
$count++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1582,7 +1612,7 @@ $minBuildNumber = 14393
|
|||||||
if ($osVersion.Build -ge $minBuildNumber) {
|
if ($osVersion.Build -ge $minBuildNumber) {
|
||||||
$subkeyHashTable = @{}
|
$subkeyHashTable = @{}
|
||||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
$keyNumber = $subkeyName -replace '.*-', ''
|
$keyNumber = $subkeyName -replace '.*-', ''
|
||||||
$subkeyHashTable[$keyNumber] = $true
|
$subkeyHashTable[$keyNumber] = $true
|
||||||
}
|
}
|
||||||
@@ -1596,7 +1626,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
||||||
if ($_ -match '.*-.*-.*-.*-.*-') {
|
if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ 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%fix_service
|
echo Check this webpage for help - %mas%fix_service
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20
|
ping 127.0.0.1 -n 20
|
||||||
@@ -127,7 +127,7 @@ 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:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
@@ -173,7 +173,7 @@ echo Failed to detect Windows build number.
|
|||||||
echo:
|
echo:
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -222,33 +222,6 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
|
||||||
|
|
||||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
|
|
||||||
echo:
|
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
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 dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
@@ -261,6 +234,58 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
|
%eline%
|
||||||
|
echo: %tstresult%
|
||||||
|
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||||
|
|
||||||
|
REM check LanguageMode
|
||||||
|
|
||||||
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%fix_powershell
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check Powershell core version
|
||||||
|
|
||||||
|
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||||
|
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check for Mal-ware that may cause issues with Powershell
|
||||||
|
|
||||||
|
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||||
|
echo "%%f"
|
||||||
|
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check antivirus and other errors
|
||||||
|
|
||||||
|
echo PowerShell is not working properly. Aborting...
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
@@ -271,34 +296,33 @@ set terminal=
|
|||||||
|
|
||||||
:: Check if script is running in Terminal app
|
:: 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 (
|
if defined terminal (
|
||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
set lines=0
|
||||||
|
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||||
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined ps32onArm goto :skipQE
|
|
||||||
if %_unattended%==1 goto :skipQE
|
if %_unattended%==1 goto :skipQE
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||||
|
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||||
|
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||||
|
|
||||||
|
set resetQE=1
|
||||||
|
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||||
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set "launchcmd=start conhost.exe %psc%"
|
start conhost.exe "!_batf!" %_args% -qedit
|
||||||
) else (
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
set "launchcmd=%psc%"
|
exit /b
|
||||||
|
) else if %resetQE% EQU 1 (
|
||||||
|
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||||
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 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
|
:skipQE
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -307,12 +331,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
|||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
set pingp=
|
||||||
set upver=%masver:.=%
|
set upver=%masver:.=%
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
|
for %%A in (
|
||||||
if not "%%#"=="" set old=1
|
activ%-%ated.win
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
|
mass%-%grave.dev
|
||||||
if not "%%#"=="" set old=
|
) do if not defined pingp (
|
||||||
|
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||||
|
if not "%%B"=="" (set old=1& set pingp=1)
|
||||||
|
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||||
|
if not "%%C"=="" set old=
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -392,7 +422,7 @@ if defined _fmiss (
|
|||||||
echo [%_fmiss%] file is missing, aborting...
|
echo [%_fmiss%] file is missing, aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -449,7 +479,7 @@ echo Evaluation editions cannot be activated outside of their evaluation period.
|
|||||||
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
|
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%evaluation_editions
|
set fixes=%fixes% %mas%evaluation_editions
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
@@ -465,7 +495,7 @@ if not exist "!_work!\clipup.exe" (
|
|||||||
echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions.
|
echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions.
|
||||||
echo The file is required for KMS38 activation.
|
echo The file is required for KMS38 activation.
|
||||||
echo Check the below page for instructions on how to activate it.
|
echo Check the below page for instructions on how to activate it.
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%kms38"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%kms38"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -477,7 +507,7 @@ if defined a_cor (
|
|||||||
if !errorlevel!==3 (
|
if !errorlevel!==3 (
|
||||||
%eline%
|
%eline%
|
||||||
echo Valid digital signature not found in clipup.exe file.
|
echo Valid digital signature not found in clipup.exe file.
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -545,13 +575,13 @@ if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
|
|||||||
if defined skunotfound (
|
if defined skunotfound (
|
||||||
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined sppks (
|
if defined sppks (
|
||||||
call :dk_color %Red% "KMS38 activation is supported but failed to find the key."
|
call :dk_color %Red% "KMS38 activation is supported but failed to find the key."
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined skunotfound if not defined sppks (
|
if not defined skunotfound if not defined sppks (
|
||||||
@@ -601,7 +631,7 @@ if %_wmic% EQU 0 for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELE
|
|||||||
if not defined app (
|
if not defined app (
|
||||||
call :dk_color %Red% "Checking Installed GVLK Activation ID [Not Found] Aborting..."
|
call :dk_color %Red% "Checking Installed GVLK Activation ID [Not Found] Aborting..."
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto :dk_done
|
goto :dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -769,7 +799,7 @@ goto :k_final
|
|||||||
call :dk_color %Red% "Activation Failed"
|
call :dk_color %Red% "Activation Failed"
|
||||||
if not defined error call :dk_color %Blue% "%_fixmsg%"
|
if not defined error call :dk_color %Blue% "%_fixmsg%"
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -884,7 +914,7 @@ $key.SetAccessControl($acl)
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
@@ -1154,7 +1184,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||||
@@ -1275,7 +1305,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators
|
|||||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||||
if defined results call :dk_color %Red% "%results%"
|
if defined results call :dk_color %Red% "%results%"
|
||||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1395,7 +1425,7 @@ set showfix=1
|
|||||||
)
|
)
|
||||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
||||||
set fixes=%fixes% %mas%fix_service
|
set fixes=%fixes% %mas%fix_service
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1452,7 +1482,7 @@ if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
|
|||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||||
set fixes=%fixes% %mas%evaluation_editions
|
set fixes=%fixes% %mas%evaluation_editions
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1582,7 +1612,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
|
|||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
@@ -1597,7 +1627,7 @@ set error=1
|
|||||||
set showfix=1
|
set showfix=1
|
||||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -1722,7 +1752,7 @@ exit /b
|
|||||||
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
||||||
$count = 0
|
$count = 0
|
||||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
$count++
|
$count++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1731,7 +1761,7 @@ $minBuildNumber = 14393
|
|||||||
if ($osVersion.Build -ge $minBuildNumber) {
|
if ($osVersion.Build -ge $minBuildNumber) {
|
||||||
$subkeyHashTable = @{}
|
$subkeyHashTable = @{}
|
||||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
$keyNumber = $subkeyName -replace '.*-', ''
|
$keyNumber = $subkeyName -replace '.*-', ''
|
||||||
$subkeyHashTable[$keyNumber] = $true
|
$subkeyHashTable[$keyNumber] = $true
|
||||||
}
|
}
|
||||||
@@ -1745,7 +1775,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
||||||
if ($_ -match '.*-.*-.*-.*-.*-') {
|
if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ 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%fix_service
|
echo Check this webpage for help - %mas%fix_service
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20
|
ping 127.0.0.1 -n 20
|
||||||
@@ -124,7 +124,7 @@ 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:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
@@ -167,7 +167,7 @@ echo Failed to detect Windows build number.
|
|||||||
echo:
|
echo:
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -212,33 +212,6 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
|
||||||
|
|
||||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
|
|
||||||
echo:
|
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
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 dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
@@ -251,6 +224,58 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
|
%eline%
|
||||||
|
echo: %tstresult%
|
||||||
|
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||||
|
|
||||||
|
REM check LanguageMode
|
||||||
|
|
||||||
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%fix_powershell
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check Powershell core version
|
||||||
|
|
||||||
|
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||||
|
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check for Mal-ware that may cause issues with Powershell
|
||||||
|
|
||||||
|
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||||
|
echo "%%f"
|
||||||
|
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check antivirus and other errors
|
||||||
|
|
||||||
|
echo PowerShell is not working properly. Aborting...
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
@@ -261,34 +286,33 @@ set terminal=
|
|||||||
|
|
||||||
:: Check if script is running in Terminal app
|
:: 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 (
|
if defined terminal (
|
||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
set lines=0
|
||||||
|
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||||
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined ps32onArm goto :skipQE
|
|
||||||
if %_unattended%==1 goto :skipQE
|
if %_unattended%==1 goto :skipQE
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||||
|
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||||
|
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||||
|
|
||||||
|
set resetQE=1
|
||||||
|
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||||
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set "launchcmd=start conhost.exe %psc%"
|
start conhost.exe "!_batf!" %_args% -qedit
|
||||||
) else (
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
set "launchcmd=%psc%"
|
exit /b
|
||||||
|
) else if %resetQE% EQU 1 (
|
||||||
|
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||||
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 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
|
:skipQE
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -297,12 +321,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
|||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
set pingp=
|
||||||
set upver=%masver:.=%
|
set upver=%masver:.=%
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
|
for %%A in (
|
||||||
if not "%%#"=="" set old=1
|
activ%-%ated.win
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
|
mass%-%grave.dev
|
||||||
if not "%%#"=="" set old=
|
) do if not defined pingp (
|
||||||
|
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||||
|
if not "%%B"=="" (set old=1& set pingp=1)
|
||||||
|
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||||
|
if not "%%C"=="" set old=
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -383,7 +413,7 @@ if not exist %SysPath%\sppsvc.exe (
|
|||||||
echo [%SysPath%\sppsvc.exe] file is missing, aborting...
|
echo [%SysPath%\sppsvc.exe] file is missing, aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -662,7 +692,7 @@ call :dk_color %Red% "Some errors were detected."
|
|||||||
if not defined ierror if not defined showfix if not defined serv_cor if not defined serv_cste call :dk_color %Blue% "%_fixmsg%"
|
if not defined ierror if not defined showfix if not defined serv_cor if not defined serv_cste call :dk_color %Blue% "%_fixmsg%"
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
goto :dk_done
|
goto :dk_done
|
||||||
@@ -793,7 +823,6 @@ set _prids=
|
|||||||
set _config=
|
set _config=
|
||||||
set _version=
|
set _version=
|
||||||
set _License=
|
set _License=
|
||||||
set _oBranding=
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -1006,7 +1035,7 @@ call :dk_color %_Yellow% "%mas%"
|
|||||||
:: Add SharedComputerLicensing registry key if Retail Office C2R is installed on Windows Server
|
:: 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
|
:: 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 defined winserver if defined _config if exist "%_oLPath%\Word2019VL_KMS_Client_AE*.xrm-ms" (
|
||||||
echo %_oIds% | find /i "Retail" %nul1% && (
|
echo %_oIds% | find /i "Retail" %nul1% && (
|
||||||
set scaIsNeeded=1
|
set scaIsNeeded=1
|
||||||
reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1%
|
reg add %_config% /v SharedComputerLicensing /t REG_SZ /d "1" /f %nul1%
|
||||||
@@ -1047,20 +1076,11 @@ set "_common=%CommonProgramFiles%"
|
|||||||
if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%"
|
if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%"
|
||||||
set "_common2=%CommonProgramFiles(x86)%"
|
set "_common2=%CommonProgramFiles(x86)%"
|
||||||
|
|
||||||
for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f"
|
call :msiofficedata %2
|
||||||
if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f"
|
|
||||||
|
|
||||||
call :ohookdata getmsiprod %2
|
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Activating Office... [MSI ^| %_version% ^| %_oArch%]
|
echo Activating Office... [MSI ^| %_version% ^| %_oArch%]
|
||||||
|
|
||||||
if not defined _oBranding (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking BRANDING.XML [Not Found, aborting activation...]"
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
if not defined _oIds (
|
if not defined _oIds (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Installed Products [Product IDs not found, aborting activation...]"
|
call :dk_color %Red% "Checking Installed Products [Product IDs not found, aborting activation...]"
|
||||||
@@ -1306,7 +1326,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
@@ -1485,7 +1505,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||||
@@ -1545,7 +1565,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators
|
|||||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||||
if defined results call :dk_color %Red% "%results%"
|
if defined results call :dk_color %Red% "%results%"
|
||||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1665,7 +1685,7 @@ set showfix=1
|
|||||||
)
|
)
|
||||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
||||||
set fixes=%fixes% %mas%fix_service
|
set fixes=%fixes% %mas%fix_service
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1722,7 +1742,7 @@ if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
|
|||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||||
set fixes=%fixes% %mas%evaluation_editions
|
set fixes=%fixes% %mas%evaluation_editions
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1852,7 +1872,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
|
|||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
@@ -1867,7 +1887,7 @@ set error=1
|
|||||||
set showfix=1
|
set showfix=1
|
||||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -1992,7 +2012,7 @@ exit /b
|
|||||||
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
||||||
$count = 0
|
$count = 0
|
||||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
$count++
|
$count++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2001,7 +2021,7 @@ $minBuildNumber = 14393
|
|||||||
if ($osVersion.Build -ge $minBuildNumber) {
|
if ($osVersion.Build -ge $minBuildNumber) {
|
||||||
$subkeyHashTable = @{}
|
$subkeyHashTable = @{}
|
||||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
$keyNumber = $subkeyName -replace '.*-', ''
|
$keyNumber = $subkeyName -replace '.*-', ''
|
||||||
$subkeyHashTable[$keyNumber] = $true
|
$subkeyHashTable[$keyNumber] = $true
|
||||||
}
|
}
|
||||||
@@ -2015,7 +2035,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
||||||
if ($_ -match '.*-.*-.*-.*-.*-') {
|
if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
@@ -2317,13 +2337,138 @@ if %oVer%==16 (echo "%%D" | find /i "Subscription" %nul% && set _sublic=1)
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if %1==getmsiprod if %oVer%==%%A (
|
)
|
||||||
for /f "tokens=*" %%x in ('findstr /i /c:"%%B" "%_oBranding%"') do set "prodId=%%x"
|
)
|
||||||
set prodId=!prodId:"/>=!
|
exit /b
|
||||||
set prodId=!prodId:~-4!
|
|
||||||
reg query "%2\Registration\{%%B}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && (
|
::========================================================================================================================================
|
||||||
reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && (
|
|
||||||
if defined _oIds (set _oIds=!_oIds! %%E) else (set _oIds=%%E)
|
:: 1st column = Office version number
|
||||||
|
:: 2nd column = Activation ID
|
||||||
|
:: 3rd column = Product ID from branding.xml
|
||||||
|
:: 4th column = Edition
|
||||||
|
:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only)
|
||||||
|
:: Separator = "_"
|
||||||
|
|
||||||
|
:msiofficedata
|
||||||
|
|
||||||
|
for %%# in (
|
||||||
|
:: Office 2013
|
||||||
|
15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail
|
||||||
|
15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail
|
||||||
|
15_4374022d-56b8-48c1-9bb7-d8f2fc726343_0015_AccessVolume
|
||||||
|
15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_0016_ExcelRetail
|
||||||
|
15_ac1ae7fd-b949-4e04-a330-849bc40638cf_0016_ExcelVolume
|
||||||
|
15_cfaf5356-49e3-48a8-ab3c-e729ab791250_00BA_GrooveRetail
|
||||||
|
15_4825ac28-ce41-45a7-9e6e-1fed74057601_00BA_GrooveVolume
|
||||||
|
15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail
|
||||||
|
15_cd256150-a898-441f-aac0-9f8f33390e45_0013_HomeBusinessRetail
|
||||||
|
15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_00CE_HomeStudentARMRetail
|
||||||
|
15_ebef9f05-5273-404a-9253-c5e252f50555_00DA_HomeStudentPlusARMRetail
|
||||||
|
15_98685d21-78bd-4c62-bc4f-653344a63035_002F_HomeStudentRetail
|
||||||
|
15_44984381-406e-4a35-b1c3-e54f499556e2_0044_InfoPathRetail
|
||||||
|
15_9e016989-4007-42a6-8051-64eb97110cf2_0044_InfoPathVolume
|
||||||
|
15_9103f3ce-1084-447a-827e-d6097f68c895_00EA_LyncAcademicRetail
|
||||||
|
15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_012D_LyncEntryRetail
|
||||||
|
15_fada6658-bfc6-4c4e-825a-59a89822cda8_012C_LyncRetail
|
||||||
|
15_e1264e10-afaf-4439-a98b-256df8bb156f_012C_LyncVolume
|
||||||
|
15_3169c8df-f659-4f95-9cc6-3115e6596e83_000F_MondoRetail
|
||||||
|
15_f33485a0-310b-4b72-9a0e-b1d605510dbd_000F_MondoVolume
|
||||||
|
15_3391e125-f6e4-4b1e-899c-a25e6092d40d_00A1_OneNoteFreeRetail
|
||||||
|
15_8b524bcc-67ea-4876-a509-45e46f6347e8_00A1_OneNoteRetail
|
||||||
|
15_b067e965-7521-455b-b9f7-c740204578a2_00A1_OneNoteVolume
|
||||||
|
15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_001A_OutlookRetail
|
||||||
|
15_8d577c50-ae5e-47fd-a240-24986f73d503_001A_OutlookVolume
|
||||||
|
15_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail
|
||||||
|
15_17e9df2d-ed91-4382-904b-4fed6a12caf0_0033_PersonalRetail
|
||||||
|
15_31743b82-bfbc-44b6-aa12-85d42e644d5b_0018_PowerPointRetail
|
||||||
|
15_e40dcb44-1d5c-4085-8e8f-943f33c4f004_0018_PowerPointVolume
|
||||||
|
15_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail
|
||||||
|
15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_0014_ProfessionalRetail
|
||||||
|
15_f2435de4-5fc0-4e5b-ac97-34f515ec5ee7_003B_ProjectProRetail
|
||||||
|
15_ed34dc89-1c27-4ecd-8b2f-63d0f4cedc32_003B_ProjectProVolume
|
||||||
|
15_5517e6a2-739b-4822-946f-7f0f1c5934b1_003A_ProjectStdRetail
|
||||||
|
15_2b9e4a37-6230-4b42-bee2-e25ce86c8c7a_003A_ProjectStdVolume
|
||||||
|
15_064383fa-1538-491c-859b-0ecab169a0ab_0011_ProPlusRetail
|
||||||
|
15_2b88c4f2-ea8f-43cd-805e-4d41346e18a7_0011_ProPlusVolume
|
||||||
|
15_c3a0814a-70a4-471f-af37-2313a6331111_0019_PublisherRetail
|
||||||
|
15_38ea49f6-ad1d-43f1-9888-99a35d7c9409_0019_PublisherVolume
|
||||||
|
15_ba3e3833-6a7e-445a-89d0-7802a9a68588_0017_SPDRetail
|
||||||
|
15_32255c0a-16b4-4ce2-b388-8a4267e219eb_0012_StandardRetail
|
||||||
|
15_a24cca51-3d54-4c41-8a76-4031f5338cb2_0012_StandardVolume
|
||||||
|
15_15d12ad4-622d-4257-976c-5eb3282fb93d_0051_VisioProRetail
|
||||||
|
15_3e4294dd-a765-49bc-8dbd-cf8b62a4bd3d_0051_VisioProVolume
|
||||||
|
15_dae597ce-5823-4c77-9580-7268b93a4b23_0053_VisioStdRetail
|
||||||
|
15_44a1f6ff-0876-4edb-9169-dbb43101ee89_0053_VisioStdVolume
|
||||||
|
15_191509f2-6977-456f-ab30-cf0492b1e93a_001B_WordRetail
|
||||||
|
15_9cedef15-be37-4ff0-a08a-13a045540641_001B_WordVolume
|
||||||
|
:: Office 365 - 15.0 version
|
||||||
|
15_befee371-a2f5-4648-85db-a2c55fdf324c_00E9_O365BusinessRetail
|
||||||
|
15_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail
|
||||||
|
15_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail
|
||||||
|
15_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail
|
||||||
|
:: Office 365 - 16.0 version
|
||||||
|
16_6337137e-7c07-4197-8986-bece6a76fc33_00E9_O365BusinessRetail
|
||||||
|
16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_00D6_O365EduCloudRetail
|
||||||
|
16_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail
|
||||||
|
16_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail
|
||||||
|
16_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail
|
||||||
|
:: Office 2016
|
||||||
|
16_bfa358b0-98f1-4125-842e-585fa13032e6_0015_AccessRetail
|
||||||
|
16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_001C_AccessRuntimeRetail
|
||||||
|
16_3b2fa33f-cd5a-43a5-bd95-f49f3f546b0b_0015_AccessVolume
|
||||||
|
16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_0016_ExcelRetail
|
||||||
|
16_685062a7-6024-42e7-8c5f-6bb9e63e697f_0016_ExcelVolume
|
||||||
|
16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail
|
||||||
|
16_86834d00-7896-4a38-8fae-32f20b86fa2b_0013_HomeBusinessRetail
|
||||||
|
16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_00CE_HomeStudentARMRetail
|
||||||
|
16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_00DA_HomeStudentPlusARMRetail
|
||||||
|
16_c28acdb8-d8b3-4199-baa4-024d09e97c99_002F_HomeStudentRetail
|
||||||
|
16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_002F_HomeStudentVNextRetail
|
||||||
|
16_b21367df-9545-4f02-9f24-240691da0e58_000F_MondoRetail
|
||||||
|
16_2cd0ea7e-749f-4288-a05e-567c573b2a6c_000F_MondoVolume
|
||||||
|
16_436366de-5579-4f24-96db-3893e4400030_00A3_OneNoteFreeRetail
|
||||||
|
16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_00A1_OneNoteRetail
|
||||||
|
16_23b672da-a456-4860-a8f3-e062a501d7e8_00A1_OneNoteVolume
|
||||||
|
16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_001A_OutlookRetail
|
||||||
|
16_50059979-ac6f-4458-9e79-710bcb41721a_001A_OutlookVolume
|
||||||
|
16_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail
|
||||||
|
16_a9f645a1-0d6a-4978-926a-abcb363b72a6_0033_PersonalRetail
|
||||||
|
16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_0018_PowerPointRetail
|
||||||
|
16_9b4060c9-a7f5-4a66-b732-faf248b7240f_0018_PowerPointVolume
|
||||||
|
16_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail
|
||||||
|
16_d64edc00-7453-4301-8428-197343fafb16_0014_ProfessionalRetail
|
||||||
|
16_0f42f316-00b1-48c5-ada4-2f52b5720ad0_003B_ProjectProRetail
|
||||||
|
16_82f502b5-b0b0-4349-bd2c-c560df85b248_003B_ProjectProVolume
|
||||||
|
16_16728639-a9ab-4994-b6d8-f81051e69833_003B_ProjectProXVolume
|
||||||
|
16_e9f0b3fc-962f-4944-ad06-05c10b6bcd5e_003A_ProjectStdRetail
|
||||||
|
16_82e6b314-2a62-4e51-9220-61358dd230e6_003A_ProjectStdVolume
|
||||||
|
16_431058f0-c059-44c5-b9e7-ed2dd46b6789_003A_ProjectStdXVolume
|
||||||
|
16_de52bd50-9564-4adc-8fcb-a345c17f84f9_0011_ProPlusRetail
|
||||||
|
16_c47456e3-265d-47b6-8ca0-c30abbd0ca36_0011_ProPlusVolume
|
||||||
|
16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_0019_PublisherRetail
|
||||||
|
16_fcc1757b-5d5f-486a-87cf-c4d6dedb6032_0019_PublisherVolume
|
||||||
|
16_971cd368-f2e1-49c1-aedd-330909ce18b6_012D_SkypeforBusinessEntryRetail
|
||||||
|
16_418d2b9f-b491-4d7f-84f1-49e27cc66597_012C_SkypeforBusinessRetail
|
||||||
|
16_03ca3b9a-0869-4749-8988-3cbc9d9f51bb_012C_SkypeforBusinessVolume
|
||||||
|
16_9103f3ce-1084-447a-827e-d6097f68c895_012C_SkypeServiceBypassRetail
|
||||||
|
16_4a31c291-3a12-4c64-b8ab-cd79212be45e_0012_StandardRetail
|
||||||
|
16_0ed94aac-2234-4309-ba29-74bdbb887083_0012_StandardVolume
|
||||||
|
16_2dfe2075-2d04-4e43-816a-eb60bbb77574_0051_VisioProRetail
|
||||||
|
16_295b2c03-4b1c-4221-b292-1411f468bd02_0051_VisioProVolume
|
||||||
|
16_0594dc12-8444-4912-936a-747ca742dbdb_0051_VisioProXVolume
|
||||||
|
16_c76dbcbc-d71b-4f45-b5b3-b7494cb4e23e_0053_VisioStdRetail
|
||||||
|
16_44151c2d-c398-471f-946f-7660542e3369_0053_VisioStdVolume
|
||||||
|
16_1d1c6879-39a3-47a5-9a6d-aceefa6a289d_0053_VisioStdXVolume
|
||||||
|
16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_001B_WordRetail
|
||||||
|
16_c3000759-551f-4f4a-bcac-a4b42cbf1de2_001B_WordVolume
|
||||||
|
) do (
|
||||||
|
for /f "tokens=1-5 delims=_" %%A in ("%%#") do (
|
||||||
|
|
||||||
|
if "%oVer%"=="%%A" (
|
||||||
|
reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && (
|
||||||
|
reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && (
|
||||||
|
if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ 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%fix_service
|
echo Check this webpage for help - %mas%fix_service
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20
|
ping 127.0.0.1 -n 20
|
||||||
@@ -149,7 +149,7 @@ 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:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
@@ -198,7 +198,7 @@ echo Failed to detect Windows build number.
|
|||||||
echo:
|
echo:
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -241,33 +241,6 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
|
||||||
|
|
||||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
|
|
||||||
echo:
|
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
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 dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
@@ -280,6 +253,58 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
|
%eline%
|
||||||
|
echo: %tstresult%
|
||||||
|
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||||
|
|
||||||
|
REM check LanguageMode
|
||||||
|
|
||||||
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%fix_powershell
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check Powershell core version
|
||||||
|
|
||||||
|
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||||
|
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check for Mal-ware that may cause issues with Powershell
|
||||||
|
|
||||||
|
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||||
|
echo "%%f"
|
||||||
|
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check antivirus and other errors
|
||||||
|
|
||||||
|
echo PowerShell is not working properly. Aborting...
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
@@ -290,34 +315,33 @@ set terminal=
|
|||||||
|
|
||||||
:: Check if script is running in Terminal app
|
:: 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 (
|
if defined terminal (
|
||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
set lines=0
|
||||||
|
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||||
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined ps32onArm goto :skipQE
|
|
||||||
if %_unattended%==1 goto :skipQE
|
if %_unattended%==1 goto :skipQE
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||||
|
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||||
|
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||||
|
|
||||||
|
set resetQE=1
|
||||||
|
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||||
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set "launchcmd=start conhost.exe %psc%"
|
start conhost.exe "!_batf!" %_args% -qedit
|
||||||
) else (
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
set "launchcmd=%psc%"
|
exit /b
|
||||||
|
) else if %resetQE% EQU 1 (
|
||||||
|
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||||
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 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
|
:skipQE
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -326,12 +350,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
|||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
set pingp=
|
||||||
set upver=%masver:.=%
|
set upver=%masver:.=%
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
|
for %%A in (
|
||||||
if not "%%#"=="" set old=1
|
activ%-%ated.win
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
|
mass%-%grave.dev
|
||||||
if not "%%#"=="" set old=
|
) do if not defined pingp (
|
||||||
|
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||||
|
if not "%%B"=="" (set old=1& set pingp=1)
|
||||||
|
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||||
|
if not "%%C"=="" set old=
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -443,7 +473,7 @@ if not exist %SysPath%\sppsvc.exe (
|
|||||||
echo [%SysPath%\sppsvc.exe] file is missing, aborting...
|
echo [%SysPath%\sppsvc.exe] file is missing, aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -536,7 +566,7 @@ call :dk_color %Blue% "Go back to main menu and use [Change Edition] option."
|
|||||||
) else (
|
) else (
|
||||||
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
|
call :dk_color %Blue% "Use TSforge activation option from the main menu to reset evaluation period."
|
||||||
set fixes=%fixes% %mas%evaluation_editions
|
set fixes=%fixes% %mas%evaluation_editions
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
|
|
||||||
goto :ks_office
|
goto :ks_office
|
||||||
@@ -586,13 +616,13 @@ if %winbuild% LSS 9200 if exist "%SysPath%\spp\tokens\skus\Security-SPP-Componen
|
|||||||
if defined skunotfound (
|
if defined skunotfound (
|
||||||
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined sppks (
|
if defined sppks (
|
||||||
call :dk_color %Red% "%KS% activation is supported but failed to find the %KS% key."
|
call :dk_color %Red% "%KS% activation is supported but failed to find the %KS% key."
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined skunotfound if not defined sppks (
|
if not defined skunotfound if not defined sppks (
|
||||||
@@ -999,7 +1029,7 @@ set _prids=
|
|||||||
set _config=
|
set _config=
|
||||||
set _version=
|
set _version=
|
||||||
set _License=
|
set _License=
|
||||||
set _oBranding=
|
set _oMSI=
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -1113,7 +1143,7 @@ exit /b
|
|||||||
for %%# in (%_oIds%) do (
|
for %%# in (%_oIds%) do (
|
||||||
|
|
||||||
set skipprocess=
|
set skipprocess=
|
||||||
if %_NoEditionChange%==1 if not defined _oBranding (
|
if %_NoEditionChange%==1 if not defined _oMSI (
|
||||||
set foundprod=
|
set foundprod=
|
||||||
call :ksdata chkprod %%#
|
call :ksdata chkprod %%#
|
||||||
if not defined foundprod (
|
if not defined foundprod (
|
||||||
@@ -1162,7 +1192,7 @@ if not "!key!"=="" (
|
|||||||
echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
|
echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic
|
||||||
call :dk_inskey "[!key!] [!_prod!]"
|
call :dk_inskey "[!key!] [!_prod!]"
|
||||||
) else (
|
) else (
|
||||||
if not defined _oBranding (
|
if not defined _oMSI (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]"
|
call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]"
|
||||||
call :dk_color %Blue% "Make sure you are using Latest MAS script."
|
call :dk_color %Blue% "Make sure you are using Latest MAS script."
|
||||||
@@ -1185,6 +1215,7 @@ exit /b
|
|||||||
:: Process Office MSI Version
|
:: Process Office MSI Version
|
||||||
|
|
||||||
call :ks_reset
|
call :ks_reset
|
||||||
|
set _oMSI=1
|
||||||
|
|
||||||
if "%1"=="14" (
|
if "%1"=="14" (
|
||||||
call :dk_actids 59a52881-a989-479d-af46-f275c6370663
|
call :dk_actids 59a52881-a989-479d-af46-f275c6370663
|
||||||
@@ -1205,21 +1236,11 @@ set "_common=%CommonProgramFiles%"
|
|||||||
if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%"
|
if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%"
|
||||||
set "_common2=%CommonProgramFiles(x86)%"
|
set "_common2=%CommonProgramFiles(x86)%"
|
||||||
|
|
||||||
for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f"
|
call :msiofficedata %2
|
||||||
if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f"
|
|
||||||
|
|
||||||
call :ksdata getmsiprod %2
|
|
||||||
call :ks_msiretaildata getmsiret %2
|
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
echo Processing Office... [MSI ^| %_version% ^| %_oArch%]
|
echo Processing Office... [MSI ^| %_version% ^| %_oArch%]
|
||||||
|
|
||||||
if not defined _oBranding (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]"
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
|
|
||||||
if not defined _oIds (
|
if not defined _oIds (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]"
|
call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]"
|
||||||
@@ -1625,7 +1646,7 @@ set _tserror=
|
|||||||
set winbuild=1
|
set winbuild=1
|
||||||
set "nul=>nul 2>&1"
|
set "nul=>nul 2>&1"
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
|
|
||||||
set run_once=
|
set run_once=
|
||||||
set t_name=Renewal Task
|
set t_name=Renewal Task
|
||||||
@@ -2311,7 +2332,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
@@ -2578,7 +2599,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
:: Get Product name (WMI/REG methods are not reliable in all conditions, hence winbrand.dll method is used)
|
||||||
@@ -2699,7 +2720,7 @@ if defined pupfound call :dk_color %Gray% "Checking PUP Activators
|
|||||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||||
if defined results call :dk_color %Red% "%results%"
|
if defined results call :dk_color %Red% "%results%"
|
||||||
set fixes=%fixes% %mas%remove_mal%w%ware
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -2819,7 +2840,7 @@ set showfix=1
|
|||||||
)
|
)
|
||||||
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
echo %serv_e% | findstr /i "sppsvc-1060" %nul% && (
|
||||||
set fixes=%fixes% %mas%fix_service
|
set fixes=%fixes% %mas%fix_service
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_service"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_service"
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -2876,7 +2897,7 @@ if not defined notwinact if exist "%SystemRoot%\Servicing\Packages\Microsoft-Win
|
|||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2% | find /i "Eval" %nul1% || (
|
||||||
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
call :dk_color %Red% "Checking Eval Packages [Non-Eval Licenses are installed in Eval Windows]"
|
||||||
set fixes=%fixes% %mas%evaluation_editions
|
set fixes=%fixes% %mas%evaluation_editions
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%evaluation_editions"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -3006,7 +3027,7 @@ call :dk_color %Red% "Checking SkipRearm [Default 0 Value N
|
|||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Plugins\Objects\msft:rm/algorithm/hwid/4.0" /f ba02fed39662 /d %nul% || (
|
||||||
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
call :dk_color %Red% "Checking SPP Registry Key [Incorrect ModuleId Found]"
|
||||||
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
set fixes=%fixes% %mas%issues_due_to_gaming_spoofers
|
||||||
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
call :dk_color2 %Blue% "Most likely caused by gaming spoofers. Check this webpage for help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
@@ -3021,7 +3042,7 @@ set error=1
|
|||||||
set showfix=1
|
set showfix=1
|
||||||
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
call :dk_color %Red% "Checking TokenStore Registry Key [Correct Path Not Found] [%tokenstore%]"
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -3146,7 +3167,7 @@ exit /b
|
|||||||
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
$wpaKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $env:COMPUTERNAME).OpenSubKey("SYSTEM\\WPA")
|
||||||
$count = 0
|
$count = 0
|
||||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
$count++
|
$count++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3155,7 +3176,7 @@ $minBuildNumber = 14393
|
|||||||
if ($osVersion.Build -ge $minBuildNumber) {
|
if ($osVersion.Build -ge $minBuildNumber) {
|
||||||
$subkeyHashTable = @{}
|
$subkeyHashTable = @{}
|
||||||
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
foreach ($subkeyName in $wpaKey.GetSubKeyNames()) {
|
||||||
if ($subkeyName -match '.*-.*-.*-.*-.*-') {
|
if ($subkeyName -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
$keyNumber = $subkeyName -replace '.*-', ''
|
$keyNumber = $subkeyName -replace '.*-', ''
|
||||||
$subkeyHashTable[$keyNumber] = $true
|
$subkeyHashTable[$keyNumber] = $true
|
||||||
}
|
}
|
||||||
@@ -3169,7 +3190,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
$wpaKey.GetSubKeyNames() | ForEach-Object {
|
||||||
if ($_ -match '.*-.*-.*-.*-.*-') {
|
if ($_ -match '8DEC0AF1-0341-4b93-85CD-72606C2DF94C.*') {
|
||||||
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||||
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
cmd /c "reg query "HKLM\SYSTEM\WPA\$_" /ve /t REG_BINARY >nul 2>&1"
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
@@ -3240,132 +3261,190 @@ exit /b
|
|||||||
|
|
||||||
:: 1st column = Office version number
|
:: 1st column = Office version number
|
||||||
:: 2nd column = Activation ID
|
:: 2nd column = Activation ID
|
||||||
:: 3rd column = Edition
|
:: 3rd column = Product ID from branding.xml
|
||||||
:: 4th column = Other Edition IDs if they are part of the same primary product (For reference only)
|
:: 4th column = Edition
|
||||||
|
:: 5th column = Other Edition IDs if they are part of the same primary product (For reference only)
|
||||||
:: Separator = "_"
|
:: Separator = "_"
|
||||||
|
|
||||||
:ks_msiretaildata
|
:: EditionID Notes:
|
||||||
|
:: For Office 2013 and later, all Edition IDs are clearly defined, and each ID corresponds to its specific licensing.
|
||||||
|
|
||||||
|
:: In Office 2010, the situation is a bit more complicated.
|
||||||
|
:: Products typically fall into two separate categories: Volume License (VL) and Non-VL. This is because a single installation cannot include both Retail and VL licensing types.
|
||||||
|
:: Some Edition IDs share the same primary product ID. For example, installing ProPlusVL also installs ProPlusAcadVL licenses, as both use 0011 as the primary product ID.
|
||||||
|
:: Therefore, in the script, we grouped VL and Non-VL versions by primary product ID and selected the highest Edition ID when multiple Edition IDs existed for the same primary product ID.
|
||||||
|
|
||||||
|
:: There are a few exceptions to this 2010 rule: Visio (Premium, Pro, Standard) and OEM-SingleImage.
|
||||||
|
|
||||||
|
:: For Visio, the issue is that branding.xml lists incorrect primary product IDs. The correct primary product ID for all three Visio variants is 0057. Based on the criteria above, we chose Visio-Premium as the representative Edition ID among the three.
|
||||||
|
:: For OEM-SingleImage, it installs multiple Edition IDs and uses 003D as the primary product ID. Following our method, we selected the highest available Edition ID—ProfessionalR in this case.
|
||||||
|
|
||||||
|
:msiofficedata
|
||||||
|
|
||||||
for %%# in (
|
for %%# in (
|
||||||
:: Office 2010
|
14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_0015_AccessR
|
||||||
14_4d463c2c-0505-4626-8cdb-a4da82e2d8ed_AccessR
|
14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_001C_AccessRuntimeR
|
||||||
14_745fb377-0a59-4ca9-b9a9-c359557a2c4e_AccessRuntimeR
|
14_95ab3ec8-4106-4f9d-b632-03c019d1d23f_0015_AccessVL
|
||||||
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_ExcelR
|
14_4eaff0d0-c6cb-4187-94f3-c7656d49a0aa_0016_ExcelR
|
||||||
14_7004b7f0-6407-4f45-8eac-966e5f868bde_GrooveR
|
14_71dc86ff-f056-40d0-8ffb-9592705c9b76_0016_ExcelVL
|
||||||
14_7b7d1f17-fdcb-4820-9789-9bec6e377821_HomeBusinessR_[HomeBusinessDemoR]
|
14_7004b7f0-6407-4f45-8eac-966e5f868bde_00BA_GrooveR
|
||||||
14_19316117-30a8-4773-8fd9-7f7231f4e060_HomeBusinessSubR
|
14_fdad0dfa-417d-4b4f-93e4-64ea8867b7fd_00BA_GrooveVL
|
||||||
14_09e2d37e-474b-4121-8626-58ad9be5776f_HomeStudentR_[HomeStudentDemoR]
|
14_7b7d1f17-fdcb-4820-9789-9bec6e377821_0013_HomeBusinessR_[HomeBusinessDemoR]
|
||||||
14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_HSExcelR
|
14_19316117-30a8-4773-8fd9-7f7231f4e060_011E_HomeBusinessSubR
|
||||||
14_25fe4611-b44d-49cc-ae87-2143d299194e_HSOneNoteR
|
14_09e2d37e-474b-4121-8626-58ad9be5776f_002F_HomeStudentR_[HomeStudentDemoR]
|
||||||
14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_HSPowerPointR
|
14_c3ae020c-5a71-4cc5-a27a-2a97c2d46860_0029_HSExcelR
|
||||||
14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_HSWordR
|
14_25fe4611-b44d-49cc-ae87-2143d299194e_00A3_HSOneNoteR
|
||||||
14_ef1da464-01c8-43a6-91af-e4e5713744f9_InfoPathR
|
14_d652ad8d-da5c-4358-b928-7fb1b4de7a7c_0037_HSPowerPointR
|
||||||
14_14f5946a-debc-4716-babc-7e2c240fec08_MondoR
|
14_a963d7ae-7a88-41a7-94da-8bb5635a8af9_002B_HSWordR
|
||||||
14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_OEM
|
14_ef1da464-01c8-43a6-91af-e4e5713744f9_0044_InfoPathR
|
||||||
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_OneNoteR
|
14_85e22450-b741-430c-a172-a37962c938af_0044_InfoPathVL
|
||||||
14_fbf4ac36-31c8-4340-8666-79873129cf40_OutlookR
|
14_14f5946a-debc-4716-babc-7e2c240fec08_000F_MondoR
|
||||||
14_acb51361-c0db-4895-9497-1831c41f31a6_PersonalR_[PersonalDemoR,PersonalPrepaidR]
|
14_533b656a-4425-480b-8e30-1a2358898350_000F_MondoVL
|
||||||
14_133c8359-4e93-4241-8118-30bb18737ea0_PowerPointR
|
14_c1ceda8b-c578-4d5d-a4aa-23626be4e234_003D_ProfessionalR_[OEM-SingleImage]Exception
|
||||||
14_8b559c37-0117-413e-921b-b853aeb6e210_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR]
|
14_3f7aa693-9a7e-44fc-9309-bb3d8e604925_00A1_OneNoteR
|
||||||
14_725714d7-d58f-4d12-9fa8-35873c6f7215_ProjectProR_[ProjectProMSDNR]
|
14_6860b31f-6a67-48b8-84b9-e312b3485c4b_00A1_OneNoteVL
|
||||||
14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_ProjectProSubR
|
14_fbf4ac36-31c8-4340-8666-79873129cf40_001A_OutlookR
|
||||||
14_688f6589-2bd9-424e-a152-b13f36aa6de1_ProjectStdR
|
14_a9aeabd8-63b8-4079-a28e-f531807fd6b8_001A_OutlookVL
|
||||||
14_71af7e84-93e6-4363-9b69-699e04e74071_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R]
|
14_acb51361-c0db-4895-9497-1831c41f31a6_0033_PersonalR_[PersonalDemoR,PersonalPrepaidR]
|
||||||
14_e98ef0c0-71c4-42ce-8305-287d8721e26c_ProPlusSubR
|
14_133c8359-4e93-4241-8118-30bb18737ea0_0018_PowerPointR
|
||||||
14_98677603-a668-4fa4-9980-3f1f05f78f69_PublisherR
|
14_38252940-718c-4aa6-81a4-135398e53851_0018_PowerPointVL
|
||||||
14_dbe3aee0-5183-4ff7-8142-66050173cb01_SmallBusBasicsR_[SmallBusBasicsMSDNR]
|
14_8b559c37-0117-413e-921b-b853aeb6e210_0014_ProfessionalR_[ProfessionalAcadR,ProfessionalDemoR]
|
||||||
14_b78df69e-0966-40b1-ae85-30a5134dedd0_SPDR
|
14_725714d7-d58f-4d12-9fa8-35873c6f7215_003B_ProjectProR_[ProjectProMSDNR]
|
||||||
14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_StandardR
|
14_4d06f72e-fd50-4bc2-a24b-d448d7f17ef2_011F_ProjectProSubR
|
||||||
14_2745e581-565a-4670-ae90-6bf7c57ffe43_StarterR
|
14_1cf57a59-c532-4e56-9a7d-ffa2fe94b474_003B_ProjectProVL
|
||||||
14_66cad568-c2dc-459d-93ec-2f3cb967ee34_VisioSIR_Prem[Pro,Std]
|
14_688f6589-2bd9-424e-a152-b13f36aa6de1_003A_ProjectStdR
|
||||||
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_WordR
|
14_11b39439-6b93-4642-9570-f2eb81be2238_003A_ProjectStdVL
|
||||||
|
14_71af7e84-93e6-4363-9b69-699e04e74071_0011_ProPlusR_[ProPlusAcadR,ProPlusMSDNR,Sub4R]
|
||||||
|
14_e98ef0c0-71c4-42ce-8305-287d8721e26c_011D_ProPlusSubR
|
||||||
|
14_fdf3ecb9-b56f-43b2-a9b8-1b48b6bae1a7_0011_ProPlusVL_[ProPlusAcadVL]
|
||||||
|
14_98677603-a668-4fa4-9980-3f1f05f78f69_0019_PublisherR
|
||||||
|
14_3d014759-b128-4466-9018-e80f6320d9d0_0019_PublisherVL
|
||||||
|
14_dbe3aee0-5183-4ff7-8142-66050173cb01_008B_SmallBusBasicsR_[SmallBusBasicsMSDNR]
|
||||||
|
14_8090771e-d41a-4482-929e-de87f1f47e46_008B_SmallBusBasicsVL
|
||||||
|
14_b78df69e-0966-40b1-ae85-30a5134dedd0_0017_SPDR
|
||||||
|
14_d3422cfb-8d8b-4ead-99f9-eab0ccd990d7_0012_StandardR
|
||||||
|
14_1f76e346-e0be-49bc-9954-70ec53a4fcfe_0012_StandardVL_[StandardAcadVL]
|
||||||
|
14_2745e581-565a-4670-ae90-6bf7c57ffe43_0066_StarterR
|
||||||
|
14_66cad568-c2dc-459d-93ec-2f3cb967ee34_0057_VisioSIR_Prem[Pro,Std]Exception
|
||||||
|
14_36756cb8-8e69-4d11-9522-68899507cd6a_0057_VisioSIVL_Prem[Pro,Std]Exception
|
||||||
|
14_db3bbc9c-ce52-41d1-a46f-1a1d68059119_001B_WordR
|
||||||
|
14_98d4050e-9c98-49bf-9be1-85e12eb3ab13_001B_WordVL
|
||||||
:: Office 2013
|
:: Office 2013
|
||||||
15_ab4d047b-97cf-4126-a69f-34df08e2f254_AccessRetail
|
15_ab4d047b-97cf-4126-a69f-34df08e2f254_0015_AccessRetail
|
||||||
15_259de5be-492b-44b3-9d78-9645f848f7b0_AccessRuntimeRetail
|
15_259de5be-492b-44b3-9d78-9645f848f7b0_001C_AccessRuntimeRetail
|
||||||
15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_ExcelRetail
|
15_4374022d-56b8-48c1-9bb7-d8f2fc726343_0015_AccessVolume
|
||||||
15_cfaf5356-49e3-48a8-ab3c-e729ab791250_GrooveRetail
|
15_1b1d9bd5-12ea-4063-964c-16e7e87d6e08_0016_ExcelRetail
|
||||||
15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail
|
15_ac1ae7fd-b949-4e04-a330-849bc40638cf_0016_ExcelVolume
|
||||||
15_a2b90e7a-a797-4713-af90-f0becf52a1dd_HomeBusinessRetail
|
15_cfaf5356-49e3-48a8-ab3c-e729ab791250_00BA_GrooveRetail
|
||||||
15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_HomeStudentARMRetail
|
15_4825ac28-ce41-45a7-9e6e-1fed74057601_00BA_GrooveVolume
|
||||||
15_ebef9f05-5273-404a-9253-c5e252f50555_HomeStudentPlusARMRetail
|
15_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail
|
||||||
15_f2de350d-3028-410a-bfae-283e00b44d0e_HomeStudentRetail
|
15_cd256150-a898-441f-aac0-9f8f33390e45_0013_HomeBusinessRetail
|
||||||
15_44984381-406e-4a35-b1c3-e54f499556e2_InfoPathRetail
|
15_1fdfb4e4-f9c9-41c4-b055-c80daf00697d_00CE_HomeStudentARMRetail
|
||||||
15_9103f3ce-1084-447a-827e-d6097f68c895_LyncAcademicRetail
|
15_ebef9f05-5273-404a-9253-c5e252f50555_00DA_HomeStudentPlusARMRetail
|
||||||
15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_LyncEntryRetail
|
15_98685d21-78bd-4c62-bc4f-653344a63035_002F_HomeStudentRetail
|
||||||
15_fada6658-bfc6-4c4e-825a-59a89822cda8_LyncRetail
|
15_44984381-406e-4a35-b1c3-e54f499556e2_0044_InfoPathRetail
|
||||||
15_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail
|
15_9e016989-4007-42a6-8051-64eb97110cf2_0044_InfoPathVolume
|
||||||
15_3391e125-f6e4-4b1e-899c-a25e6092d40d_OneNoteFreeRetail
|
15_9103f3ce-1084-447a-827e-d6097f68c895_00EA_LyncAcademicRetail
|
||||||
15_8b524bcc-67ea-4876-a509-45e46f6347e8_OneNoteRetail
|
15_ff693bf4-0276-4ddb-bb42-74ef1a0c9f4d_012D_LyncEntryRetail
|
||||||
15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_OutlookRetail
|
15_fada6658-bfc6-4c4e-825a-59a89822cda8_012C_LyncRetail
|
||||||
15_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail
|
15_e1264e10-afaf-4439-a98b-256df8bb156f_012C_LyncVolume
|
||||||
15_17e9df2d-ed91-4382-904b-4fed6a12caf0_PersonalRetail
|
15_3169c8df-f659-4f95-9cc6-3115e6596e83_000F_MondoRetail
|
||||||
15_31743b82-bfbc-44b6-aa12-85d42e644d5b_PowerPointRetail
|
15_f33485a0-310b-4b72-9a0e-b1d605510dbd_000F_MondoVolume
|
||||||
15_064383fa-1538-491c-859b-0ecab169a0ab_ProPlusRetail
|
15_3391e125-f6e4-4b1e-899c-a25e6092d40d_00A1_OneNoteFreeRetail
|
||||||
15_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail
|
15_8b524bcc-67ea-4876-a509-45e46f6347e8_00A1_OneNoteRetail
|
||||||
15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_ProfessionalRetail
|
15_b067e965-7521-455b-b9f7-c740204578a2_00A1_OneNoteVolume
|
||||||
15_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail
|
15_12004b48-e6c8-4ffa-ad5a-ac8d4467765a_001A_OutlookRetail
|
||||||
15_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail
|
15_8d577c50-ae5e-47fd-a240-24986f73d503_001A_OutlookVolume
|
||||||
15_c3a0814a-70a4-471f-af37-2313a6331111_PublisherRetail
|
15_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail
|
||||||
15_ba3e3833-6a7e-445a-89d0-7802a9a68588_SPDRetail
|
15_17e9df2d-ed91-4382-904b-4fed6a12caf0_0033_PersonalRetail
|
||||||
15_32255c0a-16b4-4ce2-b388-8a4267e219eb_StandardRetail
|
15_31743b82-bfbc-44b6-aa12-85d42e644d5b_0018_PowerPointRetail
|
||||||
15_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail
|
15_e40dcb44-1d5c-4085-8e8f-943f33c4f004_0018_PowerPointVolume
|
||||||
15_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail
|
15_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail
|
||||||
15_191509f2-6977-456f-ab30-cf0492b1e93a_WordRetail
|
15_44bc70e2-fb83-4b09-9082-e5557e0c2ede_0014_ProfessionalRetail
|
||||||
|
15_f2435de4-5fc0-4e5b-ac97-34f515ec5ee7_003B_ProjectProRetail
|
||||||
|
15_ed34dc89-1c27-4ecd-8b2f-63d0f4cedc32_003B_ProjectProVolume
|
||||||
|
15_5517e6a2-739b-4822-946f-7f0f1c5934b1_003A_ProjectStdRetail
|
||||||
|
15_2b9e4a37-6230-4b42-bee2-e25ce86c8c7a_003A_ProjectStdVolume
|
||||||
|
15_064383fa-1538-491c-859b-0ecab169a0ab_0011_ProPlusRetail
|
||||||
|
15_2b88c4f2-ea8f-43cd-805e-4d41346e18a7_0011_ProPlusVolume
|
||||||
|
15_c3a0814a-70a4-471f-af37-2313a6331111_0019_PublisherRetail
|
||||||
|
15_38ea49f6-ad1d-43f1-9888-99a35d7c9409_0019_PublisherVolume
|
||||||
|
15_ba3e3833-6a7e-445a-89d0-7802a9a68588_0017_SPDRetail
|
||||||
|
15_32255c0a-16b4-4ce2-b388-8a4267e219eb_0012_StandardRetail
|
||||||
|
15_a24cca51-3d54-4c41-8a76-4031f5338cb2_0012_StandardVolume
|
||||||
|
15_15d12ad4-622d-4257-976c-5eb3282fb93d_0051_VisioProRetail
|
||||||
|
15_3e4294dd-a765-49bc-8dbd-cf8b62a4bd3d_0051_VisioProVolume
|
||||||
|
15_dae597ce-5823-4c77-9580-7268b93a4b23_0053_VisioStdRetail
|
||||||
|
15_44a1f6ff-0876-4edb-9169-dbb43101ee89_0053_VisioStdVolume
|
||||||
|
15_191509f2-6977-456f-ab30-cf0492b1e93a_001B_WordRetail
|
||||||
|
15_9cedef15-be37-4ff0-a08a-13a045540641_001B_WordVolume
|
||||||
:: Office 365 - 15.0 version
|
:: Office 365 - 15.0 version
|
||||||
15_6337137e-7c07-4197-8986-bece6a76fc33_O365BusinessRetail
|
15_befee371-a2f5-4648-85db-a2c55fdf324c_00E9_O365BusinessRetail
|
||||||
15_537ea5b5-7d50-4876-bd38-a53a77caca32_O365HomePremRetail
|
15_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail
|
||||||
15_149dbce7-a48e-44db-8364-a53386cd4580_O365ProPlusRetail
|
15_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail
|
||||||
15_bacd4614-5bef-4a5e-bafc-de4c788037a2_O365SmallBusPremRetail
|
15_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail
|
||||||
:: Office 365 - 16.0 version
|
:: Office 365 - 16.0 version
|
||||||
16_6337137e-7c07-4197-8986-bece6a76fc33_O365BusinessRetail
|
16_6337137e-7c07-4197-8986-bece6a76fc33_00E9_O365BusinessRetail
|
||||||
16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_O365EduCloudRetail
|
16_2f5c71b4-5b7a-4005-bb68-f9fac26f2ea3_00D6_O365EduCloudRetail
|
||||||
16_537ea5b5-7d50-4876-bd38-a53a77caca32_O365HomePremRetail
|
16_537ea5b5-7d50-4876-bd38-a53a77caca32_00D6_O365HomePremRetail
|
||||||
16_149dbce7-a48e-44db-8364-a53386cd4580_O365ProPlusRetail
|
16_149dbce7-a48e-44db-8364-a53386cd4580_00D4_O365ProPlusRetail
|
||||||
16_bacd4614-5bef-4a5e-bafc-de4c788037a2_O365SmallBusPremRetail
|
16_bacd4614-5bef-4a5e-bafc-de4c788037a2_00D5_O365SmallBusPremRetail
|
||||||
:: Office 2016
|
:: Office 2016
|
||||||
16_bfa358b0-98f1-4125-842e-585fa13032e6_AccessRetail
|
16_bfa358b0-98f1-4125-842e-585fa13032e6_0015_AccessRetail
|
||||||
16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_AccessRuntimeRetail
|
16_9d9faf9e-d345-4b49-afce-68cb0a539c7c_001C_AccessRuntimeRetail
|
||||||
16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_ExcelRetail
|
16_3b2fa33f-cd5a-43a5-bd95-f49f3f546b0b_0015_AccessVolume
|
||||||
16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_HomeBusinessPipcRetail
|
16_424d52ff-7ad2-4bc7-8ac6-748d767b455d_0016_ExcelRetail
|
||||||
16_86834d00-7896-4a38-8fae-32f20b86fa2b_HomeBusinessRetail
|
16_685062a7-6024-42e7-8c5f-6bb9e63e697f_0016_ExcelVolume
|
||||||
16_c28acdb8-d8b3-4199-baa4-024d09e97c99_HomeStudentRetail
|
16_c02fb62e-1cd5-4e18-ba25-e0480467ffaa_00E7_HomeBusinessPipcRetail
|
||||||
16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_HomeStudentARMRetail
|
16_86834d00-7896-4a38-8fae-32f20b86fa2b_0013_HomeBusinessRetail
|
||||||
16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_HomeStudentPlusARMRetail
|
16_090896a0-ea98-48ac-b545-ba5da0eb0c9c_00CE_HomeStudentARMRetail
|
||||||
16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_HomeStudentVNextRetail
|
16_6bbe2077-01a4-4269-bf15-5bf4d8efc0b2_00DA_HomeStudentPlusARMRetail
|
||||||
16_69ec9152-153b-471a-bf35-77ec88683eae_MondoRetail
|
16_c28acdb8-d8b3-4199-baa4-024d09e97c99_002F_HomeStudentRetail
|
||||||
16_436366de-5579-4f24-96db-3893e4400030_OneNoteFreeRetail
|
16_e2127526-b60c-43e0-bed1-3c9dc3d5a468_002F_HomeStudentVNextRetail
|
||||||
16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_OneNoteRetail
|
16_b21367df-9545-4f02-9f24-240691da0e58_000F_MondoRetail
|
||||||
16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_OutlookRetail
|
16_2cd0ea7e-749f-4288-a05e-567c573b2a6c_000F_MondoVolume
|
||||||
16_5aab8561-1686-43f7-9ff5-2c861da58d17_PersonalPipcRetail
|
16_436366de-5579-4f24-96db-3893e4400030_00A3_OneNoteFreeRetail
|
||||||
16_a9f645a1-0d6a-4978-926a-abcb363b72a6_PersonalRetail
|
16_83ac4dd9-1b93-40ed-aa55-ede25bb6af38_00A1_OneNoteRetail
|
||||||
16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_PowerPointRetail
|
16_23b672da-a456-4860-a8f3-e062a501d7e8_00A1_OneNoteVolume
|
||||||
16_de52bd50-9564-4adc-8fcb-a345c17f84f9_ProPlusRetail
|
16_5a670809-0983-4c2d-8aad-d3c2c5b7d5d1_001A_OutlookRetail
|
||||||
16_4e26cac1-e15a-4467-9069-cb47b67fe191_ProfessionalPipcRetail
|
16_50059979-ac6f-4458-9e79-710bcb41721a_001A_OutlookVolume
|
||||||
16_d64edc00-7453-4301-8428-197343fafb16_ProfessionalRetail
|
16_5aab8561-1686-43f7-9ff5-2c861da58d17_00E6_PersonalPipcRetail
|
||||||
16_2f72340c-b555-418d-8b46-355944fe66b8_ProjectProRetail
|
16_a9f645a1-0d6a-4978-926a-abcb363b72a6_0033_PersonalRetail
|
||||||
16_58d95b09-6af6-453d-a976-8ef0ae0316b1_ProjectStdRetail
|
16_f32d1284-0792-49da-9ac6-deb2bc9c80b6_0018_PowerPointRetail
|
||||||
16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_PublisherRetail
|
16_9b4060c9-a7f5-4a66-b732-faf248b7240f_0018_PowerPointVolume
|
||||||
16_9103f3ce-1084-447a-827e-d6097f68c895_SkypeServiceBypassRetail
|
16_4e26cac1-e15a-4467-9069-cb47b67fe191_00E8_ProfessionalPipcRetail
|
||||||
16_971cd368-f2e1-49c1-aedd-330909ce18b6_SkypeforBusinessEntryRetail
|
16_d64edc00-7453-4301-8428-197343fafb16_0014_ProfessionalRetail
|
||||||
16_418d2b9f-b491-4d7f-84f1-49e27cc66597_SkypeforBusinessRetail
|
16_0f42f316-00b1-48c5-ada4-2f52b5720ad0_003B_ProjectProRetail
|
||||||
16_4a31c291-3a12-4c64-b8ab-cd79212be45e_StandardRetail
|
16_82f502b5-b0b0-4349-bd2c-c560df85b248_003B_ProjectProVolume
|
||||||
16_a56a3b37-3a35-4bbb-a036-eee5f1898eee_VisioProRetail
|
16_16728639-a9ab-4994-b6d8-f81051e69833_003B_ProjectProXVolume
|
||||||
16_980f9e3e-f5a8-41c8-8596-61404addf677_VisioStdRetail
|
16_e9f0b3fc-962f-4944-ad06-05c10b6bcd5e_003A_ProjectStdRetail
|
||||||
16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_WordRetail
|
16_82e6b314-2a62-4e51-9220-61358dd230e6_003A_ProjectStdVolume
|
||||||
|
16_431058f0-c059-44c5-b9e7-ed2dd46b6789_003A_ProjectStdXVolume
|
||||||
|
16_de52bd50-9564-4adc-8fcb-a345c17f84f9_0011_ProPlusRetail
|
||||||
|
16_c47456e3-265d-47b6-8ca0-c30abbd0ca36_0011_ProPlusVolume
|
||||||
|
16_6e0c1d99-c72e-4968-bcb7-ab79e03e201e_0019_PublisherRetail
|
||||||
|
16_fcc1757b-5d5f-486a-87cf-c4d6dedb6032_0019_PublisherVolume
|
||||||
|
16_971cd368-f2e1-49c1-aedd-330909ce18b6_012D_SkypeforBusinessEntryRetail
|
||||||
|
16_418d2b9f-b491-4d7f-84f1-49e27cc66597_012C_SkypeforBusinessRetail
|
||||||
|
16_03ca3b9a-0869-4749-8988-3cbc9d9f51bb_012C_SkypeforBusinessVolume
|
||||||
|
16_9103f3ce-1084-447a-827e-d6097f68c895_012C_SkypeServiceBypassRetail
|
||||||
|
16_4a31c291-3a12-4c64-b8ab-cd79212be45e_0012_StandardRetail
|
||||||
|
16_0ed94aac-2234-4309-ba29-74bdbb887083_0012_StandardVolume
|
||||||
|
16_2dfe2075-2d04-4e43-816a-eb60bbb77574_0051_VisioProRetail
|
||||||
|
16_295b2c03-4b1c-4221-b292-1411f468bd02_0051_VisioProVolume
|
||||||
|
16_0594dc12-8444-4912-936a-747ca742dbdb_0051_VisioProXVolume
|
||||||
|
16_c76dbcbc-d71b-4f45-b5b3-b7494cb4e23e_0053_VisioStdRetail
|
||||||
|
16_44151c2d-c398-471f-946f-7660542e3369_0053_VisioStdVolume
|
||||||
|
16_1d1c6879-39a3-47a5-9a6d-aceefa6a289d_0053_VisioStdXVolume
|
||||||
|
16_cacaa1bf-da53-4c3b-9700-11738ef1c2a5_001B_WordRetail
|
||||||
|
16_c3000759-551f-4f4a-bcac-a4b42cbf1de2_001B_WordVolume
|
||||||
) do (
|
) do (
|
||||||
for /f "tokens=1-5 delims=_" %%A in ("%%#") do (
|
for /f "tokens=1-5 delims=_" %%A in ("%%#") do (
|
||||||
|
|
||||||
if %1==getmsiret if "%oVer%"=="%%A" (
|
if "%oVer%"=="%%A" (
|
||||||
for /f "tokens=*" %%x in ('findstr /i /c:"%%B" "%_oBranding%"') do set "prodId=%%x"
|
reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && (
|
||||||
set prodId=!prodId:"/>=!
|
reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && (
|
||||||
set prodId=!prodId:~-4!
|
if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D)
|
||||||
if "%oVer%"=="14" (
|
|
||||||
REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml
|
|
||||||
echo %%C | find /i "Visio" %nul% && set prodId=0057
|
|
||||||
)
|
|
||||||
reg query "%2\Registration\{%%B}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && (
|
|
||||||
reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && (
|
|
||||||
if defined _oIds (set _oIds=!_oIds! %%C) else (set _oIds=%%C)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -3641,7 +3720,7 @@ if /i "%2"=="%%D" (
|
|||||||
set key=%%B
|
set key=%%B
|
||||||
set _actid=%%A
|
set _actid=%%A
|
||||||
set _allactid=!_allactid! %%A
|
set _allactid=!_allactid! %%A
|
||||||
) else if not defined _oBranding if %_NoEditionChange%==0 (
|
) else if not defined _oMSI if %_NoEditionChange%==0 (
|
||||||
echo: %%E | find /i "-%2-" %nul% && (
|
echo: %%E | find /i "-%2-" %nul% && (
|
||||||
set key=%%B
|
set key=%%B
|
||||||
set _altoffid=%%D
|
set _altoffid=%%D
|
||||||
@@ -3651,21 +3730,6 @@ set _allactid=!_allactid! %%A
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if %1==getmsiprod if "%oVer%"=="%%C" (
|
|
||||||
for /f "tokens=*" %%x in ('findstr /i /c:"%%A" "%_oBranding%"') do set "prodId=%%x"
|
|
||||||
set prodId=!prodId:"/>=!
|
|
||||||
set prodId=!prodId:~-4!
|
|
||||||
if "%oVer%"=="14" (
|
|
||||||
REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml
|
|
||||||
echo %%D | find /i "Visio" %nul% && set prodId=0057
|
|
||||||
)
|
|
||||||
reg query "%2\Registration\{%%A}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && (
|
|
||||||
reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && (
|
|
||||||
if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -10,4 +10,5 @@ Online KMS - Windows / Office - 180 Days. Lifetime With Renewal
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
For more details, check https://massgrave.dev/activations_comparison
|
Check the below link for more details:
|
||||||
|
https://massgrave.dev/chart
|
||||||
@@ -69,7 +69,7 @@ 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%fix_service
|
echo Check this webpage for help - %mas%fix_service
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20
|
ping 127.0.0.1 -n 20
|
||||||
@@ -84,7 +84,7 @@ 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:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
@@ -129,7 +129,7 @@ echo Failed to detect Windows build number.
|
|||||||
echo:
|
echo:
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -172,33 +172,6 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
|
||||||
|
|
||||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
|
|
||||||
echo:
|
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
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 dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
@@ -211,6 +184,58 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
|
%eline%
|
||||||
|
echo: %tstresult%
|
||||||
|
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||||
|
|
||||||
|
REM check LanguageMode
|
||||||
|
|
||||||
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%fix_powershell
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check Powershell core version
|
||||||
|
|
||||||
|
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||||
|
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check for Mal-ware that may cause issues with Powershell
|
||||||
|
|
||||||
|
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||||
|
echo "%%f"
|
||||||
|
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check antivirus and other errors
|
||||||
|
|
||||||
|
echo PowerShell is not working properly. Aborting...
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
@@ -221,34 +246,33 @@ set terminal=
|
|||||||
|
|
||||||
:: Check if script is running in Terminal app
|
:: 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 (
|
if defined terminal (
|
||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
set lines=0
|
||||||
|
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||||
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined ps32onArm goto :skipQE
|
|
||||||
if %_unattended%==1 goto :skipQE
|
if %_unattended%==1 goto :skipQE
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||||
|
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||||
|
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||||
|
|
||||||
|
set resetQE=1
|
||||||
|
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||||
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set "launchcmd=start conhost.exe %psc%"
|
start conhost.exe "!_batf!" %_args% -qedit
|
||||||
) else (
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
set "launchcmd=%psc%"
|
exit /b
|
||||||
|
) else if %resetQE% EQU 1 (
|
||||||
|
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||||
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 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
|
:skipQE
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -257,12 +281,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
|||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
set pingp=
|
||||||
set upver=%masver:.=%
|
set upver=%masver:.=%
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
|
for %%A in (
|
||||||
if not "%%#"=="" set old=1
|
activ%-%ated.win
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
|
mass%-%grave.dev
|
||||||
if not "%%#"=="" set old=
|
) do if not defined pingp (
|
||||||
|
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||||
|
if not "%%B"=="" (set old=1& set pingp=1)
|
||||||
|
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||||
|
if not "%%C"=="" set old=
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -298,7 +328,7 @@ if not exist %SysPath%\sppsvc.exe (
|
|||||||
echo [%SysPath%\sppsvc.exe] file is missing. Aborting...
|
echo [%SysPath%\sppsvc.exe] file is missing. Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -336,7 +366,7 @@ if %osedition%==0 (
|
|||||||
echo Failed to detect OS Edition. Aborting...
|
echo Failed to detect OS Edition. Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -409,7 +439,7 @@ echo which is not officially supported on your Windows build version %winbuild%.
|
|||||||
echo Aborting...
|
echo Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -423,7 +453,7 @@ echo Unsupported Office %verchk% is installed on your Windows build version %win
|
|||||||
echo Aborting...
|
echo Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -529,7 +559,7 @@ if not exist %SystemRoot%\Temp\%list%.txt (
|
|||||||
echo Failed to generate available editions list.
|
echo Failed to generate available editions list.
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto :oe_goback
|
goto :oe_goback
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -594,7 +624,7 @@ if not exist %SystemRoot%\Temp\getAppIds.txt (
|
|||||||
echo Failed to generate available apps list.
|
echo Failed to generate available apps list.
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto :oe_goback
|
goto :oe_goback
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -776,7 +806,7 @@ if %errorcode% EQU 0 (
|
|||||||
call :dk_color %Gray% "Now run the Office activation option from the main menu."
|
call :dk_color %Gray% "Now run the Office activation option from the main menu."
|
||||||
) else (
|
) else (
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
call :oe_tempcleanup
|
call :oe_tempcleanup
|
||||||
@@ -919,7 +949,7 @@ echo %c2rcommand%
|
|||||||
if %errorlevel% NEQ 0 (
|
if %errorlevel% NEQ 0 (
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
goto :oe_goback
|
goto :oe_goback
|
||||||
@@ -1067,7 +1097,7 @@ echo:
|
|||||||
echo %updcommand%
|
echo %updcommand%
|
||||||
%updcommand%
|
%updcommand%
|
||||||
echo:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
goto :oe_goback
|
goto :oe_goback
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -1322,7 +1352,7 @@ if ($appIdsList.Count -gt 0) {
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
@@ -1391,7 +1421,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Common lines used in PowerShell reflection code
|
:: Common lines used in PowerShell reflection code
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ 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%fix_service
|
echo Check this webpage for help - %mas%fix_service
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20
|
ping 127.0.0.1 -n 20
|
||||||
@@ -89,7 +89,7 @@ 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:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
@@ -134,7 +134,7 @@ echo Failed to detect Windows build number.
|
|||||||
echo:
|
echo:
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -177,33 +177,6 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
|
||||||
|
|
||||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
|
|
||||||
echo:
|
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
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 dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
@@ -216,6 +189,58 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
|
%eline%
|
||||||
|
echo: %tstresult%
|
||||||
|
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||||
|
|
||||||
|
REM check LanguageMode
|
||||||
|
|
||||||
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%fix_powershell
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check Powershell core version
|
||||||
|
|
||||||
|
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||||
|
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check for Mal-ware that may cause issues with Powershell
|
||||||
|
|
||||||
|
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||||
|
echo "%%f"
|
||||||
|
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check antivirus and other errors
|
||||||
|
|
||||||
|
echo PowerShell is not working properly. Aborting...
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
@@ -226,34 +251,33 @@ set terminal=
|
|||||||
|
|
||||||
:: Check if script is running in Terminal app
|
:: 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 (
|
if defined terminal (
|
||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
set lines=0
|
||||||
|
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||||
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined ps32onArm goto :skipQE
|
|
||||||
if %_unattended%==1 goto :skipQE
|
if %_unattended%==1 goto :skipQE
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||||
|
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||||
|
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||||
|
|
||||||
|
set resetQE=1
|
||||||
|
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||||
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set "launchcmd=start conhost.exe %psc%"
|
start conhost.exe "!_batf!" %_args% -qedit
|
||||||
) else (
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
set "launchcmd=%psc%"
|
exit /b
|
||||||
|
) else if %resetQE% EQU 1 (
|
||||||
|
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||||
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 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
|
:skipQE
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -262,12 +286,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
|||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
set pingp=
|
||||||
set upver=%masver:.=%
|
set upver=%masver:.=%
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
|
for %%A in (
|
||||||
if not "%%#"=="" set old=1
|
activ%-%ated.win
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
|
mass%-%grave.dev
|
||||||
if not "%%#"=="" set old=
|
) do if not defined pingp (
|
||||||
|
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||||
|
if not "%%B"=="" (set old=1& set pingp=1)
|
||||||
|
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||||
|
if not "%%C"=="" set old=
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -325,7 +355,7 @@ if not exist %SysPath%\%%# (
|
|||||||
echo [%SysPath%\%%#] file is missing, aborting...
|
echo [%SysPath%\%%#] file is missing, aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -358,7 +388,7 @@ if not defined allapps (
|
|||||||
echo Failed to find activation IDs. Aborting...
|
echo Failed to find activation IDs. Aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -381,7 +411,7 @@ if not defined osedition (
|
|||||||
echo Failed to detect OS edition, aborting...
|
echo Failed to detect OS edition, aborting...
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -543,7 +573,7 @@ echo [%targetedition% ^| %winbuild%]
|
|||||||
echo Failed to get product key from pkeyhelper.dll.
|
echo Failed to get product key from pkeyhelper.dll.
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -598,7 +628,7 @@ call :dk_color %Gray% "Reboot is required to fully change the edition."
|
|||||||
call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]"
|
call :dk_color %Red% "[Unsuccessful] [Error Code: !keyerror!]"
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -679,7 +709,7 @@ echo [%targetedition% ^| %winbuild%]
|
|||||||
echo Failed to get product key from pkeyhelper.dll.
|
echo Failed to get product key from pkeyhelper.dll.
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -755,7 +785,7 @@ echo:
|
|||||||
call :dk_color %Blue% "In case there are errors, you should restart the system before trying again."
|
call :dk_color %Blue% "In case there are errors, you should restart the system before trying again."
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%change_edition_issues
|
set fixes=%fixes% %mas%change_edition_issues
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%change_edition_issues"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%change_edition_issues"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:compresslog
|
:compresslog
|
||||||
@@ -794,7 +824,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
@@ -890,7 +920,7 @@ echo sc start sppsvc [Error Code: %spperror%]
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Help - %mas%troubleshoot'}"
|
%psc% "$job = Start-Job { (Get-WmiObject -Query 'SELECT * FROM %sps%').Version }; if (-not (Wait-Job $job -Timeout 30)) {write-host 'sppsvc is not working correctly. Check this webpage for help - %mas%troubleshoot'}"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Common lines used in PowerShell reflection code
|
:: Common lines used in PowerShell reflection code
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -69,7 +69,7 @@ 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%fix_service
|
echo Check this webpage for help - %mas%fix_service
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20
|
ping 127.0.0.1 -n 20
|
||||||
@@ -84,7 +84,7 @@ 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:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
@@ -128,7 +128,7 @@ echo Failed to detect Windows build number.
|
|||||||
echo:
|
echo:
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -171,33 +171,6 @@ goto done2
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
|
||||||
|
|
||||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
|
|
||||||
echo:
|
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
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 || (
|
||||||
@@ -210,6 +183,58 @@ goto done2
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
|
%eline%
|
||||||
|
echo: %tstresult%
|
||||||
|
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||||
|
|
||||||
|
REM check LanguageMode
|
||||||
|
|
||||||
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%fix_powershell
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||||
|
goto done2
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check Powershell core version
|
||||||
|
|
||||||
|
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||||
|
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||||
|
goto done2
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check for Mal-ware that may cause issues with Powershell
|
||||||
|
|
||||||
|
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||||
|
echo "%%f"
|
||||||
|
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
|
goto done2
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check antivirus and other errors
|
||||||
|
|
||||||
|
echo PowerShell is not working properly. Aborting...
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto done2
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
@@ -220,34 +245,33 @@ set terminal=
|
|||||||
|
|
||||||
:: Check if script is running in Terminal app
|
:: 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 (
|
if defined terminal (
|
||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
set lines=0
|
||||||
|
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||||
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined ps32onArm goto :skipQE
|
|
||||||
if %_unattended%==1 goto :skipQE
|
if %_unattended%==1 goto :skipQE
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||||
|
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||||
|
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||||
|
|
||||||
|
set resetQE=1
|
||||||
|
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||||
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set "launchcmd=start conhost.exe %psc%"
|
start conhost.exe "!_batf!" %_args% -qedit
|
||||||
) else (
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
set "launchcmd=%psc%"
|
exit /b
|
||||||
|
) else if %resetQE% EQU 1 (
|
||||||
|
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||||
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 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
|
:skipQE
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -256,12 +280,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
|||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
set pingp=
|
||||||
set upver=%masver:.=%
|
set upver=%masver:.=%
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
|
for %%A in (
|
||||||
if not "%%#"=="" set old=1
|
activ%-%ated.win
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
|
mass%-%grave.dev
|
||||||
if not "%%#"=="" set old=
|
) do if not defined pingp (
|
||||||
|
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||||
|
if not "%%B"=="" (set old=1& set pingp=1)
|
||||||
|
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||||
|
if not "%%C"=="" set old=
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -702,7 +732,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ 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%fix_service
|
echo Check this webpage for help - %mas%fix_service
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20
|
ping 127.0.0.1 -n 20
|
||||||
@@ -84,7 +84,7 @@ 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:
|
echo:
|
||||||
echo Help - %mas%troubleshoot
|
echo Check this webpage for help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 20 >nul
|
ping 127.0.0.1 -n 20 >nul
|
||||||
@@ -129,7 +129,7 @@ echo Failed to detect Windows build number.
|
|||||||
echo:
|
echo:
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -172,33 +172,6 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
|
||||||
|
|
||||||
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\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.
|
|
||||||
echo:
|
|
||||||
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
|
||||||
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 dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
@@ -211,6 +184,58 @@ goto dk_done
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
|
||||||
|
|
||||||
|
if /i not "%tstresult%"=="FullLanguage" (
|
||||||
|
%eline%
|
||||||
|
echo: %tstresult%
|
||||||
|
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
||||||
|
|
||||||
|
REM check LanguageMode
|
||||||
|
|
||||||
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
||||||
|
echo FullLanguage mode not found in PowerShell. Aborting...
|
||||||
|
echo If you have applied restrictions on Powershell then undo those changes.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%fix_powershell
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%fix_powershell"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check Powershell core version
|
||||||
|
|
||||||
|
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
||||||
|
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check for Mal-ware that may cause issues with Powershell
|
||||||
|
|
||||||
|
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
|
||||||
|
echo "%%f"
|
||||||
|
echo Mal%blank%ware found, PowerShell is not working properly.
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%remove_mal%w%ware
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
REM check antivirus and other errors
|
||||||
|
|
||||||
|
echo PowerShell is not working properly. Aborting...
|
||||||
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }"""
|
||||||
|
echo:
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
goto dk_done
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
@@ -221,34 +246,33 @@ set terminal=
|
|||||||
|
|
||||||
:: Check if script is running in Terminal app
|
:: 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 (
|
if defined terminal (
|
||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
set lines=0
|
||||||
|
for /f "skip=2 tokens=2 delims=: " %%A in ('mode con') do if "!lines!"=="0" set lines=%%A
|
||||||
|
if !lines! GEQ 100 set terminal=
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined ps32onArm goto :skipQE
|
|
||||||
if %_unattended%==1 goto :skipQE
|
if %_unattended%==1 goto :skipQE
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
:: Relaunch to disable QuickEdit in the current session and use conhost.exe instead of the Terminal app
|
||||||
|
:: This code disables QuickEdit for the current cmd.exe session without making permanent registry changes
|
||||||
|
:: It is included because clicking on the script window can pause execution, causing confusion that the script has stopped due to an error
|
||||||
|
|
||||||
|
set resetQE=1
|
||||||
|
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% && set resetQE=0
|
||||||
|
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f %nul1%
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
set "launchcmd=start conhost.exe %psc%"
|
start conhost.exe "!_batf!" %_args% -qedit
|
||||||
) else (
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
set "launchcmd=%psc%"
|
exit /b
|
||||||
|
) else if %resetQE% EQU 1 (
|
||||||
|
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
||||||
|
start reg add HKCU\Console /v QuickEdit /t REG_DWORD /d %resetQE% /f %nul1%
|
||||||
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 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
|
:skipQE
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -257,12 +281,18 @@ set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080)
|
|||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
set pingp=
|
||||||
set upver=%masver:.=%
|
set upver=%masver:.=%
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 activ%-%ated.win') do (
|
for %%A in (
|
||||||
if not "%%#"=="" set old=1
|
activ%-%ated.win
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck%upver%.activ%-%ated.win') do (
|
mass%-%grave.dev
|
||||||
if not "%%#"=="" set old=
|
) do if not defined pingp (
|
||||||
|
for /f "delims=[] tokens=2" %%B in ('ping -n 1 %%A') do (
|
||||||
|
if not "%%B"=="" (set old=1& set pingp=1)
|
||||||
|
for /f "delims=[] tokens=2" %%C in ('ping -n 1 updatecheck%upver%.%%A') do (
|
||||||
|
if not "%%C"=="" set old=
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1439,7 +1469,7 @@ exit /b
|
|||||||
|
|
||||||
:dk_setvar
|
:dk_setvar
|
||||||
|
|
||||||
set psc=powershell.exe
|
set psc=powershell.exe -nop -c
|
||||||
set winbuild=1
|
set winbuild=1
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user