mirror of
https://github.com/massgravel/Microsoft-Activation-Scripts.git
synced 2026-04-28 01:58:37 +00:00
Compare commits
133 Commits
962f7e326a
...
2.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d036f57fd | ||
|
|
ab90514b0a | ||
|
|
25abc1f457 | ||
|
|
873c4bc4d8 | ||
|
|
0b402d9afe | ||
|
|
5141866f0a | ||
|
|
f0618824a4 | ||
|
|
03cc88193d | ||
|
|
897a9db808 | ||
|
|
9bbd02cc91 | ||
|
|
d1dca45710 | ||
|
|
5e71252993 | ||
|
|
1db017f1f1 | ||
|
|
d06ba7fc4c | ||
|
|
99954a9056 | ||
|
|
fcb710a48a | ||
|
|
0cbaa141c3 | ||
|
|
9d1964ceda | ||
|
|
0477cf13e1 | ||
|
|
9b568d4b4e | ||
|
|
1c9fe0815e | ||
|
|
a5dd99ac00 | ||
|
|
1849dd3075 | ||
|
|
8fe0b24945 | ||
|
|
7c69c471c5 | ||
|
|
f32cb934dc | ||
|
|
7a6e63a462 | ||
|
|
d76b2ea57e | ||
|
|
1f0e04519a | ||
|
|
d059952ecd | ||
|
|
6efb5d50fe | ||
|
|
b2831795a4 | ||
|
|
4e8ebecd3d | ||
|
|
d929cd8fa0 | ||
|
|
d384c5f2f7 | ||
|
|
643d4f077f | ||
|
|
db26b75b64 | ||
|
|
07ad5a208d | ||
|
|
b80a502086 | ||
|
|
104d0b0dda | ||
|
|
db218720f3 | ||
|
|
b8504cc21e | ||
|
|
2e6bfa94c2 | ||
|
|
a1244dcb3b | ||
|
|
06695612a8 | ||
|
|
323c6808af | ||
|
|
841d856a29 | ||
|
|
52d4c52dba | ||
|
|
c75cd29b9f | ||
|
|
b1b5299c47 | ||
|
|
652092e985 | ||
|
|
b06c83622a | ||
|
|
ce669809bf | ||
|
|
0afb09cbd1 | ||
|
|
5d8a463475 | ||
|
|
7044f37b44 | ||
|
|
08443039aa | ||
|
|
fd8b81411c | ||
|
|
213bc50b49 | ||
|
|
00e81be52f | ||
|
|
2443e1e471 | ||
|
|
ec31fef9b9 | ||
|
|
84f5516632 | ||
|
|
f9f386a896 | ||
|
|
8e3b4135f5 | ||
|
|
bacb32f4a1 | ||
|
|
86c86c179a | ||
|
|
445a74ccea | ||
|
|
69e6c9bf71 | ||
|
|
0ced0f5d8e | ||
|
|
19be25c029 | ||
|
|
d372b62280 | ||
|
|
9e5062e7cc | ||
|
|
ed3dace78f | ||
|
|
1f50e4ba98 | ||
|
|
af7d204c96 | ||
|
|
0d26ba046e | ||
|
|
3fd1666926 | ||
|
|
bf814304c6 | ||
|
|
1dfd3f6626 | ||
|
|
79bc7b0242 | ||
|
|
ae48118ddb | ||
|
|
b983bd41da | ||
|
|
d55b9fa78c | ||
|
|
fb113c7c24 | ||
|
|
9efc3e49b9 | ||
|
|
a62c3ac36d | ||
|
|
73eabbff59 | ||
|
|
bc5efae19d | ||
|
|
deb74ab9b8 | ||
|
|
d08ed1bd38 | ||
|
|
5f5a51322d | ||
|
|
fd0e25f477 | ||
|
|
b33dcb2f72 | ||
|
|
117ba004f0 | ||
|
|
b0d898973f | ||
|
|
63b3c5097b | ||
|
|
69430c6458 | ||
|
|
9f57f585d5 | ||
|
|
52decdde18 | ||
|
|
35e044ddc8 | ||
|
|
601bd0e420 | ||
|
|
5e4988a634 | ||
|
|
3a050f2da7 | ||
|
|
31b55fd0e3 | ||
|
|
62d5d5442e | ||
|
|
f2e6e6e389 | ||
|
|
b5a305a14e | ||
|
|
6c71e82ef3 | ||
|
|
66e8cda508 | ||
|
|
98027af16d | ||
|
|
be45752a21 | ||
|
|
a421b12ae4 | ||
|
|
d06185d7f7 | ||
|
|
a46bb78e5e | ||
|
|
2470963537 | ||
|
|
89bff68b28 | ||
|
|
191121c3d4 | ||
|
|
7bf55fc6ee | ||
|
|
816925bfef | ||
|
|
ad45cf0926 | ||
|
|
29eb5bd60d | ||
|
|
70b754657f | ||
|
|
8b58696455 | ||
|
|
5d47723d07 | ||
|
|
2b786e3037 | ||
|
|
4451a25e7f | ||
|
|
886745f103 | ||
|
|
5728ba2686 | ||
|
|
ddccc4025f | ||
|
|
1567903b09 | ||
|
|
f6125eaa5b | ||
|
|
07c4fcdc74 |
7
.gitattributes
vendored
7
.gitattributes
vendored
@@ -1,3 +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
|
||||||
|
|||||||
1
LICENSE
1
LICENSE
@@ -672,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with
|
|||||||
the library. If this is what you want to do, use the GNU Lesser General
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License. But first, please read
|
Public License instead of this License. But first, please read
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|
||||||
|
|||||||
10505
MAS/All-In-One-Version-KL/MAS_AIO.cmd
Normal file
10505
MAS/All-In-One-Version-KL/MAS_AIO.cmd
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
@set masver=2.6
|
@set masver=2.8
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ set "_debug=0"
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Set Environment variables, it helps if they are misconfigured in the system
|
:: Set environment variables, it helps if they are misconfigured in the system
|
||||||
|
|
||||||
setlocal EnableExtensions
|
setlocal EnableExtensions
|
||||||
setlocal DisableDelayedExpansion
|
setlocal DisableDelayedExpansion
|
||||||
@@ -44,26 +44,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
set re1=
|
||||||
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
for %%# in (%*) do (
|
for %%# in (%*) do (
|
||||||
if /i "%%#"=="r1" set r1=1
|
if /i "%%#"=="re1" set re1=1
|
||||||
if /i "%%#"=="r2" set r2=1
|
if /i "%%#"=="re2" set re2=1
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||||
|
|
||||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||||
|
|
||||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -143,6 +145,8 @@ set _unattended=0
|
|||||||
|
|
||||||
set _args=%*
|
set _args=%*
|
||||||
if defined _args set _args=%_args:"=%
|
if defined _args set _args=%_args:"=%
|
||||||
|
if defined _args set _args=%_args:re1=%
|
||||||
|
if defined _args set _args=%_args:re2=%
|
||||||
if defined _args (
|
if defined _args (
|
||||||
for %%A in (%_args%) do (
|
for %%A in (%_args%) do (
|
||||||
if /i "%%A"=="/HWID" set _act=1
|
if /i "%%A"=="/HWID" set _act=1
|
||||||
@@ -160,21 +164,22 @@ call :dk_setvar
|
|||||||
if %winbuild% LSS 10240 (
|
if %winbuild% LSS 10240 (
|
||||||
%eline%
|
%eline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
echo HWID Activation is supported only for Windows 10/11.
|
echo HWID Activation is only supported on Windows 10/11.
|
||||||
echo Use Online KMS Activation option.
|
echo:
|
||||||
|
call :dk_color %Blue% "Use Online KMS activation option."
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
if exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-Server*Edition~*.mum" (
|
||||||
%eline%
|
%eline%
|
||||||
echo HWID Activation is not supported for Windows Server.
|
echo HWID Activation is not supported on Windows Server.
|
||||||
echo Use KMS38 or Online KMS Activation option.
|
call :dk_color %Blue% "Use KMS38 or Online KMS activation option."
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Fix special characters limitation in path name
|
:: Fix special character limitations in path name
|
||||||
|
|
||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
@@ -194,8 +199,8 @@ setlocal EnableDelayedExpansion
|
|||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo Script is launched from the temp folder,
|
echo The script was launched from the temp folder.
|
||||||
echo Most likely you are running the script directly from the archive file.
|
echo You are most likely running the script directly from the archive file.
|
||||||
echo:
|
echo:
|
||||||
echo Extract the archive file and launch the script from the extracted folder.
|
echo Extract the archive file and launch the script from the extracted folder.
|
||||||
goto dk_done
|
goto dk_done
|
||||||
@@ -214,14 +219,18 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||||||
echo:
|
echo:
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||||
echo Failed to run Powershell command but Powershell is working.
|
echo Failed to run Powershell command but Powershell is working.
|
||||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
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 PowerShell is not working. Aborting...
|
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
|
||||||
)
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %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
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,7 +242,7 @@ goto dk_done
|
|||||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||||
%eline%
|
%eline%
|
||||||
echo This script needs admin rights.
|
echo This script needs admin rights.
|
||||||
echo To do so, right click on this script and select 'Run as administrator'.
|
echo Right click on this script and select 'Run as administrator'.
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -259,6 +268,7 @@ if defined terminal (
|
|||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
%psc% "%d2%" %nul2% | find /i "True" %nul1% && 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)
|
||||||
|
|
||||||
@@ -286,20 +296,20 @@ set -=
|
|||||||
set old=
|
set old=
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined old (
|
if defined old (
|
||||||
echo ________________________________________________
|
echo ________________________________________________
|
||||||
%eline%
|
%eline%
|
||||||
echo Version %masver% of MAS is outdated.
|
echo Your version of MAS [%masver%] is outdated.
|
||||||
echo ________________________________________________
|
echo ________________________________________________
|
||||||
echo:
|
echo:
|
||||||
if not %_unattended%==1 (
|
if not %_unattended%==1 (
|
||||||
echo [1] Get Latest MAS
|
echo [1] Get Latest MAS
|
||||||
echo [0] Continue Anyway
|
echo [0] Continue Anyway
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||||
@@ -325,7 +335,7 @@ ClipUp.exe
|
|||||||
) do (
|
) do (
|
||||||
if not exist %SysPath%\%%# (
|
if not exist %SysPath%\%%# (
|
||||||
%eline%
|
%eline%
|
||||||
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% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@@ -352,12 +362,12 @@ if defined _perm (
|
|||||||
cls
|
cls
|
||||||
echo ___________________________________________________________________________________________
|
echo ___________________________________________________________________________________________
|
||||||
echo:
|
echo:
|
||||||
call :dk_color2 %_White% " " %Green% "Checking: %winos% is Permanently Activated."
|
call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
|
||||||
call :dk_color2 %_White% " " %Gray% "Activation is not required."
|
call :dk_color2 %_White% " " %Gray% "Activation is not required."
|
||||||
echo ___________________________________________________________________________________________
|
echo ___________________________________________________________________________________________
|
||||||
if %_unattended%==1 goto dk_done
|
if %_unattended%==1 goto dk_done
|
||||||
echo:
|
echo:
|
||||||
choice /C:10 /N /M "> [1] Activate [0] %_exitmsg% : "
|
choice /C:10 /N /M "> [1] Activate Anyway [0] %_exitmsg% : "
|
||||||
if errorlevel 2 exit /b
|
if errorlevel 2 exit /b
|
||||||
)
|
)
|
||||||
cls
|
cls
|
||||||
@@ -371,10 +381,10 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul2
|
|||||||
%eline%
|
%eline%
|
||||||
echo [%winos% ^| %winbuild%]
|
echo [%winos% ^| %winbuild%]
|
||||||
echo:
|
echo:
|
||||||
echo Evaluation Editions cannot be activated outside of evaluation period.
|
echo Evaluation editions cannot be activated outside of their 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% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -391,7 +401,7 @@ call :dk_showosinfo
|
|||||||
|
|
||||||
set _int=
|
set _int=
|
||||||
for %%a in (l.root-servers.net resolver1.opendns.com download.windowsupdate.com google.com) do if not defined _int (
|
for %%a in (l.root-servers.net resolver1.opendns.com download.windowsupdate.com google.com) do if not defined _int (
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (if not [%%#]==[] set _int=1)
|
for /f "delims=[] tokens=2" %%# in ('ping -n 1 %%a') do (if not "%%#"=="" set _int=1)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined _int (
|
if not defined _int (
|
||||||
@@ -404,7 +414,7 @@ echo Checking Internet Connection [Connected%ping_f%]
|
|||||||
) else (
|
) else (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Internet Connection [Not Connected]"
|
call :dk_color %Red% "Checking Internet Connection [Not Connected]"
|
||||||
call :dk_color %Blue% "Internet is required for HWID Activation."
|
call :dk_color %Blue% "Internet is required for HWID activation."
|
||||||
)
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -453,13 +463,13 @@ if not defined key (
|
|||||||
%eline%
|
%eline%
|
||||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||||
if not defined skunotfound (
|
if not defined skunotfound (
|
||||||
echo This product does not support HWID Activation.
|
echo This product does not support HWID activation.
|
||||||
echo Try KMS38 Activation option.
|
echo Make sure you are using the latest version of the script.
|
||||||
echo Make sure you are using updated version of the script.
|
echo If you are, then try KMS38 activation option.
|
||||||
set fixes=%fixes% %mas%
|
set fixes=%fixes% %mas%
|
||||||
echo %mas%
|
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% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
@@ -475,12 +485,12 @@ if defined notworking set error=1
|
|||||||
|
|
||||||
echo:
|
echo:
|
||||||
if defined changekey (
|
if defined changekey (
|
||||||
call :dk_color %Blue% "[%altedition%] Edition product key will be used to enable HWID activation."
|
call :dk_color %Blue% "[%altedition%] edition product key will be used to enable HWID activation."
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined winsub (
|
if defined winsub (
|
||||||
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]."
|
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] detected. Script will activate base edition [SKU ID-%regSKU%]."
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -522,7 +532,7 @@ call :hwiddata ticket
|
|||||||
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
|
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
|
||||||
|
|
||||||
if not exist "%tdir%\GenuineTicket.xml" (
|
if not exist "%tdir%\GenuineTicket.xml" (
|
||||||
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting the process]"
|
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting...]"
|
||||||
echo [%encoded%]
|
echo [%encoded%]
|
||||||
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
|
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
|
||||||
goto :dl_final
|
goto :dl_final
|
||||||
@@ -533,14 +543,14 @@ echo Generating GenuineTicket.xml [Successful]
|
|||||||
set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
||||||
|
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
|
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
%_xmlexist% timeout /t 2 %nul%
|
%_xmlexist% timeout /t 2 %nul%
|
||||||
%_xmlexist% timeout /t 2 %nul%
|
%_xmlexist% timeout /t 2 %nul%
|
||||||
|
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
set error=1
|
set error=1
|
||||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
||||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed With ClipSVC Service Restart, Wait...]"
|
call :dk_color %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -600,9 +610,9 @@ reg delete "%_ident%" /f %nul%
|
|||||||
reg query "%_ident%" %nul% && (
|
reg query "%_ident%" %nul% && (
|
||||||
echo:
|
echo:
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Deleting an IdentityCRL Registry [Failed] [%_ident%]"
|
call :dk_color %Red% "Deleting IdentityCRL Registry [Failed] [%_ident%]"
|
||||||
)
|
)
|
||||||
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 10 | Out-Null")
|
for %%# in (wlidsvc LicenseManager sppsvc) do (%psc% "Start-Job { Restart-Service %%# } | Wait-Job -Timeout 20 | Out-Null")
|
||||||
call :dk_refresh
|
call :dk_refresh
|
||||||
call :dk_act
|
call :dk_act
|
||||||
call :dk_checkperm
|
call :dk_checkperm
|
||||||
@@ -635,7 +645,7 @@ if not defined resfail (
|
|||||||
if defined resfail (
|
if defined resfail (
|
||||||
set error=1
|
set error=1
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %Red% "Checking Licensing Servers [Failed To Connect]"
|
call :dk_color %Red% "Checking Licensing Servers [Failed to Connect]"
|
||||||
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% "Help - " %_Yellow% " %mas%licensing-servers-issue"
|
||||||
)
|
)
|
||||||
@@ -671,7 +681,7 @@ reg query HKLM\SYSTEM\CurrentControlSet\Services\wuauserv\%%G %nul% || set wucor
|
|||||||
if defined wucorrupt (
|
if defined wucorrupt (
|
||||||
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
|
call :dk_color %Red% "Checking Windows Update Registry [Corruption Found]"
|
||||||
) else (
|
) else (
|
||||||
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 10 | Out-Null"
|
%psc% "Start-Job { Start-Service wuauserv } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
sc query wuauserv | find /i "RUNNING" %nul% || (
|
sc query wuauserv | find /i "RUNNING" %nul% || (
|
||||||
set wuerror=1
|
set wuerror=1
|
||||||
sc start wuauserv %nul%
|
sc start wuauserv %nul%
|
||||||
@@ -698,8 +708,8 @@ call :dk_color %Green% "%winos% is permanently activated with a digital license.
|
|||||||
) else (
|
) else (
|
||||||
call :dk_color %Red% "Activation Failed %error_code%"
|
call :dk_color %Red% "Activation Failed %error_code%"
|
||||||
if defined notworking (
|
if defined notworking (
|
||||||
call :dk_color %Blue% "At the time of writing this, HWID Activation was not supported for this product."
|
call :dk_color %Blue% "At the time of writing, HWID Activation is not supported for this product."
|
||||||
call :dk_color %Blue% "Use KMS38 Activation option."
|
call :dk_color %Blue% "Use KMS38 activation option 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
|
||||||
@@ -745,12 +755,16 @@ set _NCS=1
|
|||||||
if %winbuild% LSS 10586 set _NCS=0
|
if %winbuild% LSS 10586 set _NCS=0
|
||||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
|
|
||||||
|
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||||
set "Red="41;97m""
|
set "Red="41;97m""
|
||||||
set "Gray="100;97m""
|
set "Gray="100;97m""
|
||||||
set "Green="42;97m""
|
set "Green="42;97m""
|
||||||
set "Blue="44;97m""
|
set "Blue="44;97m""
|
||||||
|
set "White="107;91m""
|
||||||
|
set "_Red="40;91m""
|
||||||
set "_White="40;37m""
|
set "_White="40;37m""
|
||||||
set "_Green="40;92m""
|
set "_Green="40;92m""
|
||||||
set "_Yellow="40;93m""
|
set "_Yellow="40;93m""
|
||||||
@@ -759,6 +773,8 @@ set "Red="Red" "white""
|
|||||||
set "Gray="Darkgray" "white""
|
set "Gray="Darkgray" "white""
|
||||||
set "Green="DarkGreen" "white""
|
set "Green="DarkGreen" "white""
|
||||||
set "Blue="Blue" "white""
|
set "Blue="Blue" "white""
|
||||||
|
set "White="White" "Red""
|
||||||
|
set "_Red="Black" "Red""
|
||||||
set "_White="Black" "Gray""
|
set "_White="Black" "Gray""
|
||||||
set "_Green="Black" "Green""
|
set "_Green="Black" "Green""
|
||||||
set "_Yellow="Black" "Yellow""
|
set "_Yellow="Black" "Yellow""
|
||||||
@@ -934,7 +950,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
|||||||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Get Activation IDs from licensing files if not found through WMI
|
:: Get Activation IDs from licensing files if not found through WMI
|
||||||
@@ -986,7 +1002,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@@ -1003,7 +1019,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 20)) {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. 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)
|
||||||
@@ -1057,36 +1073,38 @@ exit /b
|
|||||||
|
|
||||||
set w=
|
set w=
|
||||||
set results=
|
set results=
|
||||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
if not defined pupfound (
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
)
|
||||||
set pupfound=%pupfound1%%pupfound2%
|
|
||||||
|
|
||||||
set hcount=0
|
set hcount=0
|
||||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||||
if %hcount%==4 set "results=[AV URLs are blocked in hosts]"
|
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||||
|
|
||||||
set wucount=0
|
|
||||||
for %%# in (wuauserv) do (
|
|
||||||
set _corrupt=
|
|
||||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
|
||||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
|
|
||||||
|
|
||||||
sc start sppsvc %nul%
|
sc start sppsvc %nul%
|
||||||
echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
|
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||||
|
set "results=%results%[Likely File Infector]"
|
||||||
|
) || (
|
||||||
|
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||||
|
)
|
||||||
|
|
||||||
if not "%results%%pupfound%"=="" (
|
if not "%results%%pupfound%"=="" (
|
||||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
||||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%"
|
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||||
|
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% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||||
|
|
||||||
|
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||||
|
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||||
|
)
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -1096,6 +1114,18 @@ exit /b
|
|||||||
set showfix=
|
set showfix=
|
||||||
call :dk_chkmal
|
call :dk_chkmal
|
||||||
|
|
||||||
|
:: Check Sandboxing
|
||||||
|
|
||||||
|
sc query Null %nul% || (
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
||||||
|
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check corrupt services
|
:: Check corrupt services
|
||||||
|
|
||||||
set serv_cor=
|
set serv_cor=
|
||||||
@@ -1113,6 +1143,7 @@ if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (s
|
|||||||
|
|
||||||
if defined serv_cor (
|
if defined serv_cor (
|
||||||
set error=1
|
set error=1
|
||||||
|
set showfix=1
|
||||||
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1165,7 +1196,7 @@ set errorcode=
|
|||||||
set checkerror=
|
set checkerror=
|
||||||
|
|
||||||
sc query %%# | find /i "RUNNING" %nul% || (
|
sc query %%# | find /i "RUNNING" %nul% || (
|
||||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
set errorcode=!errorlevel!
|
set errorcode=!errorlevel!
|
||||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||||
)
|
)
|
||||||
@@ -1179,7 +1210,7 @@ if defined serv_e (
|
|||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||||
call :dk_color %Blue% "Restart the system to fix this error."
|
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1195,14 +1226,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||||
|
|
||||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
|
|
||||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
|
||||||
set showfix=1
|
set showfix=1
|
||||||
|
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||||
|
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||||
)
|
)
|
||||||
|
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||||
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
|
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -1219,7 +1257,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
|
|||||||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||||
set error=1
|
set error=1
|
||||||
set wpaerror=1
|
set wpaerror=1
|
||||||
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]"
|
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||||
) || (
|
) || (
|
||||||
echo Checking WPA Registry Count [%wpainfo%]
|
echo Checking WPA Registry Count [%wpainfo%]
|
||||||
)
|
)
|
||||||
@@ -1229,14 +1267,18 @@ if not defined officeact 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% || (
|
||||||
set error=1
|
set error=1
|
||||||
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% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
set osedition=0
|
set osedition=0
|
||||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||||
|
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||||
|
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||||
|
|
||||||
|
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||||
|
|
||||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||||
|
|
||||||
@@ -1258,7 +1300,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
|
|||||||
|
|
||||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]"
|
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1279,11 +1321,11 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
|||||||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||||
|
|
||||||
if %errorlevel% NEQ 0 set wmifailed=1
|
if %errorlevel% NEQ 0 set wmifailed=1
|
||||||
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||||
if defined wmifailed (
|
if defined wmifailed (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||||
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
|
if not defined showfix call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1321,39 +1363,41 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
|||||||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||||
|
|
||||||
if exist "%SysPath%\wlms\wlms.exe" (
|
if exist "%SysPath%\wlms\wlms.exe" (
|
||||||
sc query wlms | find /i "RUNNING" %nul% && (
|
if %winbuild% LSS 9200 (
|
||||||
echo Checking Eval WLMS Service [Found]
|
echo Checking Eval WLMS Service [Found]
|
||||||
|
) else (
|
||||||
|
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
reg query "HKU\S-1-5-20" %nul% && (
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||||
if %winbuild% GEQ 15063 reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" %nul% || (
|
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking S-1-5-20 SPP Reg [Not Found]"
|
set showfix=1
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
)
|
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
) || (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]"
|
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (
|
for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||||
)
|
)
|
||||||
if defined _sppint (
|
if defined _sppint (
|
||||||
echo Checking SPP Interference In IFEO [%_sppint%]
|
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||||
|
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||||
|
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||||
|
set showfix=1
|
||||||
|
) || (
|
||||||
|
echo Checking SPP In IFEO [%_sppint%]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
set error=1
|
set error=1
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1361,7 +1405,7 @@ set error=1
|
|||||||
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% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
@@ -1391,17 +1435,18 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
|
|||||||
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
||||||
%psc% "!d!" %nul%
|
%psc% "!d!" %nul%
|
||||||
if exist "%tokenstore%\" (
|
if exist "%tokenstore%\" (
|
||||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]"
|
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]"
|
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
|
||||||
set error=1
|
set error=1
|
||||||
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
if not defined apps (
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
if not defined apps (
|
||||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||||
@@ -1426,30 +1471,49 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
|
|||||||
echo !taskinfo! | find /i "Ready" %nul% || (
|
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||||
|
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
:: This code checks if NT SERVICE\sppsvc has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||||
|
|
||||||
set permerror=
|
set permerror=
|
||||||
if not exist "%tokenstore%\" set permerror=1
|
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||||
if %winbuild% GEQ 9200 for %%# in (
|
for %%# in (
|
||||||
"%tokenstore%+FullControl"
|
"%tokenstore%+FullControl"
|
||||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||||
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
||||||
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
||||||
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
||||||
if !errorlevel!==2 set permerror=1
|
if !errorlevel!==2 (
|
||||||
|
if "%%A"=="%tokenstore%" (
|
||||||
|
set "permerror=Error Found In Token Folder"
|
||||||
|
) else (
|
||||||
|
set "permerror=Error Found In SPP Registries"
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if %winbuild% GEQ 9200 if defined permerror (
|
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
|
if not defined permerror (
|
||||||
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||||
|
set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies"
|
||||||
|
reg query "!pol!" %nul% || reg add "!pol!" %nul%
|
||||||
|
%psc% "$netServ = (New-Object Security.Principal.SecurityIdentifier('S-1-5-20')).Translate([Security.Principal.NTAccount]).Value; $aclString = Get-Acl 'Registry::!pol!' | Format-List | Out-String; if (-not ($aclString.Contains($netServ + ' Allow FullControl') -or $aclString.Contains('NT SERVICE\sppsvc Allow FullControl')) -or ($aclString.Contains('Deny'))) {Exit 3}" %nul%
|
||||||
|
if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if defined permerror (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking SPP Permissions [Error Found]"
|
call :dk_color %Red% "Checking SPP Permissions [!permerror!]"
|
||||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
:: If required services are not disabled or corrupted + if there is any error + SoftwareLicensingService errorlevel is not Zero + no fix was shown before
|
:: If required services are not disabled or corrupted + if there is any error + SoftwareLicensingService errorlevel is not Zero + no fix was shown before
|
||||||
@@ -1492,7 +1556,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||||||
}
|
}
|
||||||
for ($i=1; $i -le $count; $i++) {
|
for ($i=1; $i -le $count; $i++) {
|
||||||
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
||||||
Write-Output "Total Keys $count. Error Found- $i key does not exist"
|
Write-Output "Total Keys $count. Error Found - $i key does not exist."
|
||||||
$wpaKey.Close()
|
$wpaKey.Close()
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@@ -1503,7 +1567,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||||||
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) {
|
||||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||||
$wpaKey.Close()
|
$wpaKey.Close()
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@@ -1511,7 +1575,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||||||
$subkey = $wpaKey.OpenSubKey($_)
|
$subkey = $wpaKey.OpenSubKey($_)
|
||||||
$p = $subkey.GetValueNames()
|
$p = $subkey.GetValueNames()
|
||||||
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
||||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||||
$wpaKey.Close()
|
$wpaKey.Close()
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@@ -1550,13 +1614,17 @@ echo:
|
|||||||
if %_unattended%==1 timeout /t 2 & exit /b
|
if %_unattended%==1 timeout /t 2 & exit /b
|
||||||
|
|
||||||
if defined fixes (
|
if defined fixes (
|
||||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
|
call :dk_color %White% " "
|
||||||
|
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||||
|
call :dk_color %White% " "
|
||||||
|
echo:
|
||||||
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
|
call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
|
||||||
choice /c 0 /n
|
choice /c 0 /n
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@set masver=2.6
|
@set masver=2.8
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ set "_debug=0"
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Set Environment variables, it helps if they are misconfigured in the system
|
:: Set environment variables, it helps if they are misconfigured in the system
|
||||||
|
|
||||||
setlocal EnableExtensions
|
setlocal EnableExtensions
|
||||||
setlocal DisableDelayedExpansion
|
setlocal DisableDelayedExpansion
|
||||||
@@ -47,26 +47,28 @@ set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%Syste
|
|||||||
set "ComSpec=%SysPath%\cmd.exe"
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
set re1=
|
||||||
|
set re2=
|
||||||
set "_cmdf=%~f0"
|
set "_cmdf=%~f0"
|
||||||
for %%# in (%*) do (
|
for %%# in (%*) do (
|
||||||
if /i "%%#"=="r1" set r1=1
|
if /i "%%#"=="re1" set re1=1
|
||||||
if /i "%%#"=="r2" set r2=1
|
if /i "%%#"=="re2" set re2=1
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||||
|
|
||||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||||
|
|
||||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -146,6 +148,8 @@ set _unattended=0
|
|||||||
|
|
||||||
set _args=%*
|
set _args=%*
|
||||||
if defined _args set _args=%_args:"=%
|
if defined _args set _args=%_args:"=%
|
||||||
|
if defined _args set _args=%_args:re1=%
|
||||||
|
if defined _args set _args=%_args:re2=%
|
||||||
if defined _args (
|
if defined _args (
|
||||||
for %%A in (%_args%) do (
|
for %%A in (%_args%) do (
|
||||||
if /i "%%A"=="/KMS38" set _act=1
|
if /i "%%A"=="/KMS38" set _act=1
|
||||||
@@ -166,13 +170,19 @@ set "specific_kms=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectio
|
|||||||
if %winbuild% LSS 14393 (
|
if %winbuild% LSS 14393 (
|
||||||
%eline%
|
%eline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
echo KMS38 Activation is supported for Windows 10/11/Server, build 14393 and later.
|
echo KMS38 activation is only supported on Windows 10/11/Server, build 14393 and later.
|
||||||
|
echo:
|
||||||
|
if %winbuild% LSS 10240 (
|
||||||
|
call :dk_color %Blue% "Use Online KMS activation option."
|
||||||
|
) else (
|
||||||
|
call :dk_color %Blue% "Use HWID activation option."
|
||||||
|
)
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Fix special characters limitation in path name
|
:: Fix special character limitations in path name
|
||||||
|
|
||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
@@ -192,8 +202,8 @@ setlocal EnableDelayedExpansion
|
|||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo Script is launched from the temp folder,
|
echo The script was launched from the temp folder.
|
||||||
echo Most likely you are running the script directly from the archive file.
|
echo You are most likely running the script directly from the archive file.
|
||||||
echo:
|
echo:
|
||||||
echo Extract the archive file and launch the script from the extracted folder.
|
echo Extract the archive file and launch the script from the extracted folder.
|
||||||
goto dk_done
|
goto dk_done
|
||||||
@@ -212,14 +222,18 @@ cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
|||||||
echo:
|
echo:
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && (
|
||||||
echo Failed to run Powershell command but Powershell is working.
|
echo Failed to run Powershell command but Powershell is working.
|
||||||
call :dk_color %Blue% "Check if your antivirus is blocking the script."
|
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 PowerShell is not working. Aborting...
|
|
||||||
echo If you have applied restrictions on Powershell then undo those changes.
|
|
||||||
)
|
|
||||||
echo:
|
echo:
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %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
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -231,7 +245,7 @@ goto dk_done
|
|||||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||||
%eline%
|
%eline%
|
||||||
echo This script needs admin rights.
|
echo This script needs admin rights.
|
||||||
echo To do so, right click on this script and select 'Run as administrator'.
|
echo Right click on this script and select 'Run as administrator'.
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -257,6 +271,7 @@ if defined terminal (
|
|||||||
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
%psc% "%d2%" %nul2% | find /i "True" %nul1% && 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)
|
||||||
|
|
||||||
@@ -284,20 +299,20 @@ set -=
|
|||||||
set old=
|
set old=
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined old (
|
if defined old (
|
||||||
echo ________________________________________________
|
echo ________________________________________________
|
||||||
%eline%
|
%eline%
|
||||||
echo Version %masver% of MAS is outdated.
|
echo Your version of MAS [%masver%] is outdated.
|
||||||
echo ________________________________________________
|
echo ________________________________________________
|
||||||
echo:
|
echo:
|
||||||
if not %_unattended%==1 (
|
if not %_unattended%==1 (
|
||||||
echo [1] Get Latest MAS
|
echo [1] Get Latest MAS
|
||||||
echo [0] Continue Anyway
|
echo [0] Continue Anyway
|
||||||
echo:
|
echo:
|
||||||
call :dk_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||||
@@ -320,7 +335,7 @@ echo:
|
|||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
echo ____________________________________________________________
|
echo: ______________________________________________________
|
||||||
echo:
|
echo:
|
||||||
echo [1] KMS38 Activation
|
echo [1] KMS38 Activation
|
||||||
echo ____________________________________________
|
echo ____________________________________________
|
||||||
@@ -328,9 +343,9 @@ echo:
|
|||||||
echo [2] Remove KM38 Protection
|
echo [2] Remove KM38 Protection
|
||||||
echo:
|
echo:
|
||||||
echo [0] %_exitmsg%
|
echo [0] %_exitmsg%
|
||||||
echo ____________________________________________________________
|
echo: ______________________________________________________
|
||||||
echo:
|
echo:
|
||||||
call :dk_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard [1,2,0]"
|
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard [1,2,0]"
|
||||||
choice /C:120 /N
|
choice /C:120 /N
|
||||||
set _el=!errorlevel!
|
set _el=!errorlevel!
|
||||||
if !_el!==3 exit /b
|
if !_el!==3 exit /b
|
||||||
@@ -360,7 +375,7 @@ if not exist %SysPath%\ClipUp.exe if not defined a_cor (set _fmiss=%_fmiss%ClipU
|
|||||||
|
|
||||||
if defined _fmiss (
|
if defined _fmiss (
|
||||||
%eline%
|
%eline%
|
||||||
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% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||||
@@ -386,12 +401,12 @@ if defined _perm (
|
|||||||
cls
|
cls
|
||||||
echo ___________________________________________________________________________________________
|
echo ___________________________________________________________________________________________
|
||||||
echo:
|
echo:
|
||||||
call :dk_color2 %_White% " " %Green% "Checking: %winos% is Permanently Activated."
|
call :dk_color2 %_White% " " %Green% "%winos% is already permanently activated."
|
||||||
call :dk_color2 %_White% " " %Gray% "Activation is not required."
|
call :dk_color2 %_White% " " %Gray% "Activation is not required."
|
||||||
echo ___________________________________________________________________________________________
|
echo ___________________________________________________________________________________________
|
||||||
if %_unattended%==1 goto dk_done
|
if %_unattended%==1 goto dk_done
|
||||||
echo:
|
echo:
|
||||||
choice /C:10 /N /M "> [1] Activate [0] %_exitmsg% : "
|
choice /C:10 /N /M "> [1] Activate Anyway [0] %_exitmsg% : "
|
||||||
if errorlevel 2 exit /b
|
if errorlevel 2 exit /b
|
||||||
)
|
)
|
||||||
cls
|
cls
|
||||||
@@ -416,10 +431,10 @@ echo Server Evaluation cannot be activated. Convert it to full Server OS.
|
|||||||
echo:
|
echo:
|
||||||
call :dk_color %Blue% "Go Back to main menu and use [Change Edition] option."
|
call :dk_color %Blue% "Go Back to main menu and use [Change Edition] option."
|
||||||
) else (
|
) else (
|
||||||
echo Evaluation Editions cannot be activated outside of evaluation period.
|
echo Evaluation editions cannot be activated outside of their 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% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
@@ -432,11 +447,22 @@ goto dk_done
|
|||||||
if defined a_cor (
|
if defined a_cor (
|
||||||
if not exist "!_work!\clipup.exe" (
|
if not exist "!_work!\clipup.exe" (
|
||||||
%eline%
|
%eline%
|
||||||
echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] version.
|
echo clipup.exe doesn't exist in Server Cor/Acor [No GUI] versions.
|
||||||
echo It's required for KMS38 Activation.
|
echo The file is required for KMS38 activation.
|
||||||
echo Check below page on how to activate it.
|
echo Check the below page for instructions on how to activate it.
|
||||||
set fixes=%fixes% %mas%kms38
|
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%kms38"
|
||||||
echo %mas%kms38
|
goto dk_done
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Check file signature
|
||||||
|
|
||||||
|
if defined a_cor (
|
||||||
|
%psc% "if (-not (Get-AuthenticodeSignature -FilePath '!_work!\clipup.exe').IsOSBinary) {Exit 3}" %nul%
|
||||||
|
if !errorlevel!==3 (
|
||||||
|
%eline%
|
||||||
|
echo Valid digital signature not found in clipup.exe file.
|
||||||
|
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -487,27 +513,38 @@ set /a UBR=0
|
|||||||
if %osSKU%==191 if defined altkey if defined altedition (
|
if %osSKU%==191 if defined altkey if defined altedition (
|
||||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
|
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR %nul6%') do if not errorlevel 1 set /a UBR=%%b
|
||||||
if %winbuild% LSS 22598 if !UBR! LSS 2788 (
|
if %winbuild% LSS 22598 if !UBR! LSS 2788 (
|
||||||
call :dk_color %Blue% "Windows must to be updated to build 19044.2788 or higher for IotEnterpriseS KMS38 activation."
|
call :dk_color %Blue% "Windows must be updated to build 19044.2788 or higher for IotEnterpriseS KMS38 activation."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined key if defined notfoundaltactID (
|
if not defined key if defined notfoundaltactID (
|
||||||
call :dk_color %Red% "Checking Alternate Edition For KMS38 [%altedition% Activation ID Not Found]"
|
call :dk_color %Red% "Checking Alternate Edition for KMS38 [%altedition% Activation ID Not Found]"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not defined key if not defined _gvlk (
|
if not defined key if not defined _gvlk (
|
||||||
%eline%
|
echo:
|
||||||
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
echo [%winos% ^| %winbuild% ^| SKU:%osSKU%]
|
||||||
if not defined skunotfound (
|
|
||||||
echo This product does not support KMS38 Activation.
|
if exist "%SysPath%\spp\tokens\skus\%osedition%\*GVLK*.xrm-ms" set sppks=1
|
||||||
echo Make sure you are using updated version of the script.
|
|
||||||
set fixes=%fixes% %mas%
|
if defined skunotfound (
|
||||||
echo %mas%
|
call :dk_color %Red% "Required license files not found in %SysPath%\spp\tokens\skus\"
|
||||||
) else (
|
|
||||||
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% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if defined sppks (
|
||||||
|
call :dk_color %Red% "KMS38 activation is supported but failed to find the key."
|
||||||
|
set fixes=%fixes% %mas%troubleshoot
|
||||||
|
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not defined skunotfound if not defined sppks (
|
||||||
|
call :dk_color %Red% "This product does not support KMS38 activation."
|
||||||
|
call :dk_color %Blue% "Make sure you are using the latest version of the script."
|
||||||
|
set fixes=%fixes% %mas%
|
||||||
|
echo %mas%
|
||||||
|
)
|
||||||
echo:
|
echo:
|
||||||
goto dk_done
|
goto dk_done
|
||||||
)
|
)
|
||||||
@@ -518,12 +555,12 @@ goto dk_done
|
|||||||
|
|
||||||
echo:
|
echo:
|
||||||
if defined changekey (
|
if defined changekey (
|
||||||
call :dk_color %Blue% "[%altedition%] Edition product key will be used to enable KMS38 activation."
|
call :dk_color %Blue% "[%altedition%] edition product key will be used to enable KMS38 activation."
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined winsub (
|
if defined winsub (
|
||||||
call :dk_color %Blue% "Windows Subscription [SKU ID-%slcSKU%] found. Script will activate base edition [SKU ID-%regSKU%]."
|
call :dk_color %Blue% "Windows Subscription edition [SKU ID-%slcSKU%] found. Script will activate the base edition [SKU ID-%regSKU%]."
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -620,7 +657,7 @@ set "sessionId=TwBTAE0AYQBqAG8AcgBWAGUAcgBzAGkAbwBuAD0ANQA7AE8AUwBNAGkAbgBvAHIAV
|
|||||||
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
|
copy /y /b "%tdir%\GenuineTicket" "%tdir%\GenuineTicket.xml" %nul%
|
||||||
|
|
||||||
if not exist "%tdir%\GenuineTicket.xml" (
|
if not exist "%tdir%\GenuineTicket.xml" (
|
||||||
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting the process]"
|
call :dk_color %Red% "Generating GenuineTicket.xml [Failed, aborting...]"
|
||||||
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
|
if exist "%tdir%\Genuine*" del /f /q "%tdir%\Genuine*" %nul%
|
||||||
goto :k_final
|
goto :k_final
|
||||||
) else (
|
) else (
|
||||||
@@ -631,7 +668,7 @@ set "_xmlexist=if exist "%tdir%\GenuineTicket.xml""
|
|||||||
|
|
||||||
:: Stop sppsvc
|
:: Stop sppsvc
|
||||||
|
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
|
|
||||||
sc query sppsvc | find /i "STOPPED" %nul% && (
|
sc query sppsvc | find /i "STOPPED" %nul% && (
|
||||||
echo Stopping sppsvc Service [Successful]
|
echo Stopping sppsvc Service [Successful]
|
||||||
@@ -640,14 +677,14 @@ call :dk_color %Gray% "Stopping sppsvc Service [Failed]"
|
|||||||
)
|
)
|
||||||
|
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 10 | Out-Null"
|
%psc% "Start-Job { Restart-Service ClipSVC } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
%_xmlexist% timeout /t 2 %nul%
|
%_xmlexist% timeout /t 2 %nul%
|
||||||
%_xmlexist% timeout /t 2 %nul%
|
%_xmlexist% timeout /t 2 %nul%
|
||||||
|
|
||||||
%_xmlexist% (
|
%_xmlexist% (
|
||||||
set error=1
|
set error=1
|
||||||
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
if exist "%tdir%\*.xml" del /f /q "%tdir%\*.xml" %nul%
|
||||||
call :dk_color %Red% "Installing GenuineTicket.xml [Failed With ClipSVC Service Restart, Wait...]"
|
call :dk_color %Gray% "Installing GenuineTicket.xml [Failed with ClipSVC service restart, wait...]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -723,16 +760,16 @@ call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
|||||||
|
|
||||||
:k_final
|
:k_final
|
||||||
|
|
||||||
:: Remove the added Specific KMS Host (Local Host) if activation is not completed
|
:: Remove the specific KMS host (LocalHost) added by the script if activation is not completed
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
if not defined _k38 (
|
if not defined _k38 (
|
||||||
%nul% reg delete "HKLM\%specific_kms%" /f
|
%nul% reg delete "HKLM\%specific_kms%" /f
|
||||||
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
|
%nul% reg delete "HKU\S-1-5-20\%specific_kms%" /f
|
||||||
%nul% reg query "HKLM\%specific_kms%" && (
|
%nul% reg query "HKLM\%specific_kms%" && (
|
||||||
call :dk_color %Red% "Removing The Added Specific KMS Host [Failed]"
|
call :dk_color %Red% "Removing the Added Specific KMS Host [Failed]"
|
||||||
) || (
|
) || (
|
||||||
echo Removing The Added Specific KMS Host [Successful]
|
echo Removing the Added Specific KMS Host [Successful]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -742,9 +779,9 @@ if defined _k38 (
|
|||||||
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
|
%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':regdel\:.*';& ([ScriptBlock]::Create($f[1])) -protect"
|
||||||
%nul% reg delete "HKLM\%specific_kms%" /f
|
%nul% reg delete "HKLM\%specific_kms%" /f
|
||||||
%nul% reg query "HKLM\%specific_kms%" && (
|
%nul% reg query "HKLM\%specific_kms%" && (
|
||||||
echo Protect KMS38 From KMS [Successful] [Locked A Registry Key]
|
echo Protect KMS38 From KMS [Successful] [Locked a Registry Key]
|
||||||
) || (
|
) || (
|
||||||
call :dk_color %Red% "Protect KMS38 From KMS [Failed To Lock A Registry Key]"
|
call :dk_color %Red% "Protect KMS38 From KMS [Failed to Lock a Registry Key]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -754,9 +791,9 @@ if defined a_cor if exist "%_clipup%" del /f /q "%_clipup%" %nul%
|
|||||||
|
|
||||||
if defined a_cor (
|
if defined a_cor (
|
||||||
if exist "%_clipup%" (
|
if exist "%_clipup%" (
|
||||||
call :dk_color %Red% "Deleting copied clipup.exe file [Failed]"
|
call :dk_color %Red% "Deleting Copied clipup.exe File [Failed]"
|
||||||
) else (
|
) else (
|
||||||
echo Deleting copied clipup.exe file [Successful]
|
echo Deleting Copied clipup.exe File [Successful]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -840,12 +877,16 @@ set _NCS=1
|
|||||||
if %winbuild% LSS 10586 set _NCS=0
|
if %winbuild% LSS 10586 set _NCS=0
|
||||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
|
|
||||||
|
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||||
set "Red="41;97m""
|
set "Red="41;97m""
|
||||||
set "Gray="100;97m""
|
set "Gray="100;97m""
|
||||||
set "Green="42;97m""
|
set "Green="42;97m""
|
||||||
set "Blue="44;97m""
|
set "Blue="44;97m""
|
||||||
|
set "White="107;91m""
|
||||||
|
set "_Red="40;91m""
|
||||||
set "_White="40;37m""
|
set "_White="40;37m""
|
||||||
set "_Green="40;92m""
|
set "_Green="40;92m""
|
||||||
set "_Yellow="40;93m""
|
set "_Yellow="40;93m""
|
||||||
@@ -854,6 +895,8 @@ set "Red="Red" "white""
|
|||||||
set "Gray="Darkgray" "white""
|
set "Gray="Darkgray" "white""
|
||||||
set "Green="DarkGreen" "white""
|
set "Green="DarkGreen" "white""
|
||||||
set "Blue="Blue" "white""
|
set "Blue="Blue" "white""
|
||||||
|
set "White="White" "Red""
|
||||||
|
set "_Red="Black" "Red""
|
||||||
set "_White="Black" "Gray""
|
set "_White="Black" "Gray""
|
||||||
set "_Green="Black" "Green""
|
set "_Green="Black" "Green""
|
||||||
set "_Yellow="Black" "Yellow""
|
set "_Yellow="Black" "Yellow""
|
||||||
@@ -1045,7 +1088,7 @@ reg delete "%ruleskey%" /v "SuppressRulesEngine" /f %nul%
|
|||||||
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||||
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
set r2=%r1% [void]$TB.DefinePInvokeMethod('SLpTriggerServiceWorker', 'sppc.dll', 22, 1, [Int32], @([UInt32], [IntPtr], [String], [UInt32]), 1, 3);
|
||||||
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
set d1=%r2% [void]$TB.CreateType()::SLpTriggerServiceWorker(0, 0, 'reeval', 0)
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; %d1%"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; %d1%"
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:: Install License files using Powershell/WMI instead of slmgr.vbs
|
:: Install License files using Powershell/WMI instead of slmgr.vbs
|
||||||
@@ -1079,7 +1122,7 @@ function ReinstallLicenses() {
|
|||||||
|
|
||||||
set _wmic=0
|
set _wmic=0
|
||||||
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
for %%# in (wmic.exe) do @if not "%%~$PATH:#"=="" (
|
||||||
wmic path Win32_ComputerSystem get CreationClassName /value %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
cmd /c "wmic path Win32_ComputerSystem get CreationClassName /value" %nul2% | find /i "computersystem" %nul1% && set _wmic=1
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
@@ -1096,7 +1139,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 20)) {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. 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)
|
||||||
@@ -1179,7 +1222,7 @@ for %%# in (pkeyhelper.dll) do @if "%%~$PATH:#"=="" exit /b
|
|||||||
for %%# in (Volume:GVLK) do (
|
for %%# in (Volume:GVLK) do (
|
||||||
call :k_pkey %osSKU% '%%#'
|
call :k_pkey %osSKU% '%%#'
|
||||||
if defined pkey call :k_pkeychannel !pkey!
|
if defined pkey call :k_pkeychannel !pkey!
|
||||||
if /i [!pkeychannel!]==[%%#] (
|
if /i "!pkeychannel!"=="%%#" (
|
||||||
set key=!pkey!
|
set key=!pkey!
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
@@ -1195,36 +1238,38 @@ exit /b
|
|||||||
|
|
||||||
set w=
|
set w=
|
||||||
set results=
|
set results=
|
||||||
if exist "%ProgramFiles%\KM%w%Spico" set pupfound1= KM%w%Spico
|
if exist "%ProgramFiles%\KM%w%Spico" set pupfound= KM%w%Spico
|
||||||
if exist "%SysPath%\Tasks\R@1n-KMS" set pupfound2= R@inKMS
|
if not defined pupfound (
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound1= KM%w%Spico
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "AutoPico" %nul% && set pupfound= KM%w%Spico
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\taskcache\tasks" /f Path /s | find /i "R@1n" %nul% && set pupfound2= R@inKMS
|
)
|
||||||
set pupfound=%pupfound1%%pupfound2%
|
|
||||||
|
|
||||||
set hcount=0
|
set hcount=0
|
||||||
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
for %%# in (avira.com kaspersky.com virustotal.com mcafee.com) do (
|
||||||
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
find /i "%%#" %SysPath%\drivers\etc\hosts %nul% && set /a hcount+=1)
|
||||||
if %hcount%==4 set "results=[AV URLs are blocked in hosts]"
|
if %hcount%==4 set "results=[Antivirus URLs are blocked in hosts]"
|
||||||
|
|
||||||
set wucount=0
|
|
||||||
for %%# in (wuauserv) do (
|
|
||||||
set _corrupt=
|
|
||||||
for %%G in (DependOnService Description DisplayName ErrorControl ImagePath ObjectName Start Type) do if not defined _corrupt (
|
|
||||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\%%# /v %%G %nul% || (set _corrupt=1 & set /a wucount+=1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if %wucount% GEQ 1 set "results=%results%[WU registry is corrupt]"
|
|
||||||
|
|
||||||
sc start sppsvc %nul%
|
sc start sppsvc %nul%
|
||||||
echo "%errorlevel%" | findstr "577 225" %nul% && set "results=%results%[Likely File Infector]"
|
echo "%errorlevel%" | findstr "577 225" %nul% && (
|
||||||
|
set "results=%results%[Likely File Infector]"
|
||||||
|
) || (
|
||||||
|
if not exist %SysPath%\sppsvc.exe if not exist %SysPath%\alg.exe (set "results=%results%[Likely File Infector]")
|
||||||
|
)
|
||||||
|
|
||||||
if not "%results%%pupfound%"=="" (
|
if not "%results%%pupfound%"=="" (
|
||||||
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
if defined pupfound call :dk_color %Gray% "Checking PUP Activators [Found%pupfound%]"
|
||||||
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection %results%"
|
if defined results call :dk_color %Red% "Checking Probable Mal%w%ware Infection..."
|
||||||
|
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% "Help - " %_Yellow% " %mas%remove_mal%w%ware"
|
||||||
echo:
|
echo:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:: Remove the scheduled task of R@1n-KMS (old version) that runs the activation command every minute, as it leads to high CPU usage.
|
||||||
|
|
||||||
|
if exist %SysPath%\Tasks\R@1n-KMS (
|
||||||
|
for /f %%A in ('dir /b /a:-d %SysPath%\Tasks\R@1n-KMS %nul6%') do (schtasks /delete /tn \R@1n-KMS\%%A /f %nul%)
|
||||||
|
)
|
||||||
|
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -1234,6 +1279,18 @@ exit /b
|
|||||||
set showfix=
|
set showfix=
|
||||||
call :dk_chkmal
|
call :dk_chkmal
|
||||||
|
|
||||||
|
:: Check Sandboxing
|
||||||
|
|
||||||
|
sc query Null %nul% || (
|
||||||
|
set error=1
|
||||||
|
set showfix=1
|
||||||
|
call :dk_color %Red% "Checking Sandboxing [Found, script may not work properly.]"
|
||||||
|
call :dk_color %Blue% "If you are using any third-party antivirus, check if it is blocking the script."
|
||||||
|
echo:
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check corrupt services
|
:: Check corrupt services
|
||||||
|
|
||||||
set serv_cor=
|
set serv_cor=
|
||||||
@@ -1251,6 +1308,7 @@ if defined _corrupt (if defined serv_cor (set "serv_cor=!serv_cor! %%#") else (s
|
|||||||
|
|
||||||
if defined serv_cor (
|
if defined serv_cor (
|
||||||
set error=1
|
set error=1
|
||||||
|
set showfix=1
|
||||||
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
call :dk_color %Red% "Checking Corrupt Services [%serv_cor%]"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1303,7 +1361,7 @@ set errorcode=
|
|||||||
set checkerror=
|
set checkerror=
|
||||||
|
|
||||||
sc query %%# | find /i "RUNNING" %nul% || (
|
sc query %%# | find /i "RUNNING" %nul% || (
|
||||||
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 10 | Out-Null"
|
%psc% "Start-Job { Start-Service %%# } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
set errorcode=!errorlevel!
|
set errorcode=!errorlevel!
|
||||||
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
sc query %%# | find /i "RUNNING" %nul% || set checkerror=1
|
||||||
)
|
)
|
||||||
@@ -1317,7 +1375,7 @@ if defined serv_e (
|
|||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
call :dk_color %Red% "Starting Services [Failed] [%serv_e%]"
|
||||||
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
echo %serv_e% | findstr /i "ClipSVC-1058 sppsvc-1058" %nul% && (
|
||||||
call :dk_color %Blue% "Restart the system to fix this error."
|
call :dk_color %Blue% "Reboot your machine using the restart option to fix this error."
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1333,14 +1391,21 @@ call :dk_color2 %Red% "Checking Boot Mode [%safeboot_option
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
:: https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
for /f "skip=2 tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State" /v ImageState') do (set imagestate=%%B)
|
||||||
|
|
||||||
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
if /i not "%imagestate%"=="IMAGE_STATE_COMPLETE" (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Windows Setup State [%imagestate%]"
|
|
||||||
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
|
||||||
set showfix=1
|
set showfix=1
|
||||||
|
call :dk_color %Gray% "Checking Windows Setup State [%imagestate%]"
|
||||||
|
echo "%imagestate%" | find /i "RESEAL" %nul% && (
|
||||||
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
call :dk_color %Blue% "You need to run it in normal mode in case you are running it in Audit Mode."
|
||||||
)
|
)
|
||||||
|
echo "%imagestate%" | find /i "UNDEPLOYABLE" %nul% && (
|
||||||
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
|
call :dk_color2 %Blue% "If the activation fails, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -1357,7 +1422,7 @@ for /f "delims=" %%a in ('%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':w
|
|||||||
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
echo "%wpainfo%" | find /i "Error Found" %nul% && (
|
||||||
set error=1
|
set error=1
|
||||||
set wpaerror=1
|
set wpaerror=1
|
||||||
call :dk_color %Red% "Checking WPA Registry Error [%wpainfo%]"
|
call :dk_color %Red% "Checking WPA Registry Errors [%wpainfo%]"
|
||||||
) || (
|
) || (
|
||||||
echo Checking WPA Registry Count [%wpainfo%]
|
echo Checking WPA Registry Count [%wpainfo%]
|
||||||
)
|
)
|
||||||
@@ -1367,14 +1432,18 @@ if not defined officeact 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% || (
|
||||||
set error=1
|
set error=1
|
||||||
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% "Help - " %_Yellow% " %mas%evaluation_editions"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
set osedition=0
|
set osedition=0
|
||||||
for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
if %_wmic% EQU 1 set "chkedi=for /f "tokens=2 delims==" %%a in ('"wmic path %spp% where (ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL) get LicenseFamily /VALUE" %nul6%')"
|
||||||
|
if %_wmic% EQU 0 set "chkedi=for /f "tokens=2 delims==" %%a in ('%psc% "(([WMISEARCHER]'SELECT LicenseFamily FROM %spp% WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND LicenseDependsOn is NULL AND PartialProductKey IS NOT NULL').Get()).LicenseFamily ^| %% {echo ('LicenseFamily='+$_)}" %nul6%')"
|
||||||
|
%chkedi% do if not errorlevel 1 (call set "osedition=%%a")
|
||||||
|
|
||||||
|
if %osedition%==0 for /f "skip=2 tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionID %nul6%') do set "osedition=%%a"
|
||||||
|
|
||||||
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
:: Workaround for an issue in builds between 1607 and 1709 where ProfessionalEducation is shown as Professional
|
||||||
|
|
||||||
@@ -1396,7 +1465,7 @@ call :dk_color %Red% "Checking License Files [Not Found] [%osed
|
|||||||
|
|
||||||
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
if not exist "%SystemRoot%\Servicing\Packages\Microsoft-Windows-*-%osedition%-*.mum" (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking Package File [Not Found] [%osedition%]"
|
call :dk_color %Red% "Checking Package Files [Not Found] [%osedition%]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1417,11 +1486,11 @@ if %_wmic% EQU 1 wmic path Win32_ComputerSystem get CreationClassName /value %nu
|
|||||||
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
if %_wmic% EQU 0 %psc% "Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property CreationClassName" %nul2% | find /i "computersystem" %nul1%
|
||||||
|
|
||||||
if %errorlevel% NEQ 0 set wmifailed=1
|
if %errorlevel% NEQ 0 set wmifailed=1
|
||||||
echo "%error_code%" | findstr /i "0x800410 0x800440" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
echo "%error_code%" | findstr /i "0x800410 0x800440 0x80131501" %nul1% && set wmifailed=1& :: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants
|
||||||
if defined wmifailed (
|
if defined wmifailed (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking WMI [Not Working]"
|
call :dk_color %Red% "Checking WMI [Not Working]"
|
||||||
call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
|
if not defined showfix call :dk_color %Blue% "Go back to Main Menu, select Troubleshoot and run Fix WMI option."
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1459,39 +1528,41 @@ call :dk_color2 %Red% "Checking ClipSVC " %Blue% "[System
|
|||||||
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
:: This "WLMS" service was included in previous Eval editions (which were activable) to automatically shut down the system every hour after the evaluation period expired and prevent SPPSVC from stopping.
|
||||||
|
|
||||||
if exist "%SysPath%\wlms\wlms.exe" (
|
if exist "%SysPath%\wlms\wlms.exe" (
|
||||||
sc query wlms | find /i "RUNNING" %nul% && (
|
if %winbuild% LSS 9200 (
|
||||||
echo Checking Eval WLMS Service [Found]
|
echo Checking Eval WLMS Service [Found]
|
||||||
|
) else (
|
||||||
|
call :dk_color %Red% "Checking Eval WLMS Service [Found]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
reg query "HKU\S-1-5-20" %nul% && (
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% || (
|
||||||
if %winbuild% GEQ 15063 reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" %nul% || (
|
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking S-1-5-20 SPP Reg [Not Found]"
|
set showfix=1
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
call :dk_color %Red% "Checking HKU\S-1-5-20 Registry [Not Found]"
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
set fixes=%fixes% %mas%in-place_repair_upgrade
|
||||||
)
|
call :dk_color2 %Blue% "In case of activation issues, do this - " %_Yellow% " %mas%in-place_repair_upgrade"
|
||||||
) || (
|
|
||||||
set error=1
|
|
||||||
call :dk_color %Red% "Checking HKU\S-1-5-20 Reg [Not Found]"
|
|
||||||
set fixes=%fixes% %mas%troubleshoot
|
|
||||||
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
for %%# in (SppEx%w%tComObj.exe sppsvc.exe) do (
|
for %%# in (SppEx%w%tComObj.exe sppsvc.exe sppsvc.exe\PerfOptions) do (
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ima%w%ge File Execu%w%tion Options\%%#" %nul% && (if defined _sppint (set "_sppint=!_sppint!, %%#") else (set "_sppint=%%#"))
|
||||||
)
|
)
|
||||||
if defined _sppint (
|
if defined _sppint (
|
||||||
echo Checking SPP Interference In IFEO [%_sppint%]
|
echo %_sppint% | find /i "PerfOptions" %nul% && (
|
||||||
|
call :dk_color %Red% "Checking SPP Interference In IFEO [%_sppint% - System might deactivate later]"
|
||||||
|
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||||
|
set showfix=1
|
||||||
|
) || (
|
||||||
|
echo Checking SPP In IFEO [%_sppint%]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
for /f "skip=2 tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" %nul6%') do if /i %%b NEQ 0x0 (
|
||||||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "SkipRearm" /t REG_DWORD /d "0" /f %nul%
|
||||||
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
call :dk_color %Red% "Checking SkipRearm [Default 0 Value Not Found. Changing To 0]"
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null"
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null"
|
||||||
set error=1
|
set error=1
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1499,7 +1570,7 @@ set error=1
|
|||||||
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% "Possibly Caused By Gaming Spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
call :dk_color2 %Blue% "Most likely caused by HWID spoofers. Help - " %_Yellow% " %mas%issues_due_to_gaming_spoofers"
|
||||||
set error=1
|
set error=1
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
@@ -1529,17 +1600,18 @@ set "d=!d! $AclObject.SetSecurityDescriptorSddlForm($sddl);"
|
|||||||
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
set "d=!d! Set-Acl -Path %tokenstore% -AclObject $AclObject;"
|
||||||
%psc% "!d!" %nul%
|
%psc% "!d!" %nul%
|
||||||
if exist "%tokenstore%\" (
|
if exist "%tokenstore%\" (
|
||||||
call :dk_color %Gray% "Checking SPP Token Folder [Not Found. Created Now] [%tokenstore%\]"
|
call :dk_color %Gray% "Checking SPP Token Folder [Not Found, Created Now] [%tokenstore%\]"
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %Red% "Checking SPP Token Folder [Not Found. Failed To Create] [%tokenstore%\]"
|
call :dk_color %Red% "Checking SPP Token Folder [Not Found, Failed to Create] [%tokenstore%\]"
|
||||||
set error=1
|
set error=1
|
||||||
|
set showfix=1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
if not defined apps (
|
||||||
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 10 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
%psc% "Start-Job { Stop-Service sppsvc -force } | Wait-Job -Timeout 20 | Out-Null; $sls = Get-WmiObject SoftwareLicensingService; $f=[io.file]::ReadAllText('!_batp!') -split ':xrm\:.*';iex ($f[1]); ReinstallLicenses" %nul%
|
||||||
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
call :dk_actid 55c92734-d682-4d71-983e-d6ec3f16059f
|
||||||
if not defined apps (
|
if not defined apps (
|
||||||
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
set "_notfoundids=Key Not Installed / Act ID Not Found"
|
||||||
@@ -1564,30 +1636,49 @@ for /f "delims=" %%a in ('%psc% "(Get-ScheduledTask -TaskName 'SvcRestartTask' -
|
|||||||
echo !taskinfo! | find /i "Ready" %nul% || (
|
echo !taskinfo! | find /i "Ready" %nul% || (
|
||||||
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v "actionlist" /f %nul%
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTask" %nul% || set taskinfo=Removed
|
||||||
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!]"
|
if "!taskinfo!"=="" set "taskinfo=Not Found"
|
||||||
|
call :dk_color %Red% "Checking SvcRestartTask Status [!taskinfo!, System might deactivate later]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
:: This code checks if NT SERVICE\sppsvc has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
:: This code checks if SPP has permission access to tokens folder and required registry keys. It's often caused by gaming spoofers.
|
||||||
|
|
||||||
set permerror=
|
set permerror=
|
||||||
if not exist "%tokenstore%\" set permerror=1
|
if %winbuild% GEQ 9200 if not defined ps32onArm (
|
||||||
if %winbuild% GEQ 9200 for %%# in (
|
for %%# in (
|
||||||
"%tokenstore%+FullControl"
|
"%tokenstore%+FullControl"
|
||||||
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
"HKLM:\SYSTEM\WPA+QueryValues, EnumerateSubKeys, WriteKey"
|
||||||
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform+SetValue"
|
||||||
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
) do for /f "tokens=1,2 delims=+" %%A in (%%#) do if not defined permerror (
|
||||||
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
%psc% "$acl = (Get-Acl '%%A' | fl | Out-String); if (-not ($acl -match 'NT SERVICE\\sppsvc Allow %%B') -or ($acl -match 'NT SERVICE\\sppsvc Deny')) {Exit 2}" %nul%
|
||||||
if !errorlevel!==2 set permerror=1
|
if !errorlevel!==2 (
|
||||||
|
if "%%A"=="%tokenstore%" (
|
||||||
|
set "permerror=Error Found In Token Folder"
|
||||||
|
) else (
|
||||||
|
set "permerror=Error Found In SPP Registries"
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if %winbuild% GEQ 9200 if defined permerror (
|
REM https://learn.microsoft.com/office/troubleshoot/activation/license-issue-when-start-office-application
|
||||||
|
|
||||||
|
if not defined permerror (
|
||||||
|
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
|
||||||
|
set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies"
|
||||||
|
reg query "!pol!" %nul% || reg add "!pol!" %nul%
|
||||||
|
%psc% "$netServ = (New-Object Security.Principal.SecurityIdentifier('S-1-5-20')).Translate([Security.Principal.NTAccount]).Value; $aclString = Get-Acl 'Registry::!pol!' | Format-List | Out-String; if (-not ($aclString.Contains($netServ + ' Allow FullControl') -or $aclString.Contains('NT SERVICE\sppsvc Allow FullControl')) -or ($aclString.Contains('Deny'))) {Exit 3}" %nul%
|
||||||
|
if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if defined permerror (
|
||||||
set error=1
|
set error=1
|
||||||
call :dk_color %Red% "Checking SPP Permissions [Error Found]"
|
call :dk_color %Red% "Checking SPP Permissions [!permerror!]"
|
||||||
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
if not defined showfix call :dk_color %Blue% "%_fixmsg%"
|
||||||
set showfix=1
|
set showfix=1
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
:: If required services are not disabled or corrupted + if there is any error + SoftwareLicensingService errorlevel is not Zero + no fix was shown before
|
:: If required services are not disabled or corrupted + if there is any error + SoftwareLicensingService errorlevel is not Zero + no fix was shown before
|
||||||
@@ -1630,7 +1721,7 @@ if ($osVersion.Build -ge $minBuildNumber) {
|
|||||||
}
|
}
|
||||||
for ($i=1; $i -le $count; $i++) {
|
for ($i=1; $i -le $count; $i++) {
|
||||||
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
if (-not $subkeyHashTable.ContainsKey("$i")) {
|
||||||
Write-Output "Total Keys $count. Error Found- $i key does not exist"
|
Write-Output "Total Keys $count. Error Found - $i key does not exist."
|
||||||
$wpaKey.Close()
|
$wpaKey.Close()
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@@ -1641,7 +1732,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||||||
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) {
|
||||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||||
$wpaKey.Close()
|
$wpaKey.Close()
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@@ -1649,7 +1740,7 @@ $wpaKey.GetSubKeyNames() | ForEach-Object {
|
|||||||
$subkey = $wpaKey.OpenSubKey($_)
|
$subkey = $wpaKey.OpenSubKey($_)
|
||||||
$p = $subkey.GetValueNames()
|
$p = $subkey.GetValueNames()
|
||||||
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
if (($p | Where-Object { $subkey.GetValueKind($_) -eq [Microsoft.Win32.RegistryValueKind]::Binary }).Count -eq 0) {
|
||||||
Write-Host "Total Keys $count. Error Found- Binary Data is corrupt"
|
Write-Host "Total Keys $count. Error Found - Binary Data is corrupt."
|
||||||
$wpaKey.Close()
|
$wpaKey.Close()
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@@ -1688,13 +1779,17 @@ echo:
|
|||||||
if %_unattended%==1 timeout /t 2 & exit /b
|
if %_unattended%==1 timeout /t 2 & exit /b
|
||||||
|
|
||||||
if defined fixes (
|
if defined fixes (
|
||||||
call :dk_color2 %Blue% "Press [1] To Open Troubleshoot Page " %Gray% " Press [0] To Ignore"
|
call :dk_color %White% " "
|
||||||
|
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||||
|
call :dk_color %White% " "
|
||||||
|
echo:
|
||||||
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined terminal (
|
if defined terminal (
|
||||||
call :dk_color %_Yellow% "Press 0 key to %_exitmsg%..."
|
call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
|
||||||
choice /c 0 /n
|
choice /c 0 /n
|
||||||
) else (
|
) else (
|
||||||
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1443
MAS/Separate-Files-Version/Change_Office_Edition.cmd
Normal file
1443
MAS/Separate-Files-Version/Change_Office_Edition.cmd
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,10 +6,23 @@
|
|||||||
:: https://gravesoft.dev/cas
|
:: https://gravesoft.dev/cas
|
||||||
|
|
||||||
|
|
||||||
|
:: Set Environment variables, it helps if they are misconfigured in the system
|
||||||
|
|
||||||
|
setlocal EnableExtensions
|
||||||
|
setlocal DisableDelayedExpansion
|
||||||
|
|
||||||
|
set "PathExt=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
|
||||||
|
|
||||||
|
set "SysPath=%SystemRoot%\System32"
|
||||||
set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
||||||
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
||||||
|
set "SysPath=%SystemRoot%\Sysnative"
|
||||||
set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
|
set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
set "_psc=powershell -nop -c"
|
set "_psc=powershell -nop -c"
|
||||||
set "_err===== ERROR ===="
|
set "_err===== ERROR ===="
|
||||||
set _pwsh=1
|
set _pwsh=1
|
||||||
@@ -29,8 +42,8 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
:E_Exit
|
:E_Exit
|
||||||
echo.
|
echo.
|
||||||
echo Press any key to exit.
|
echo Press 0 key to exit.
|
||||||
pause >nul
|
choice /c 0 /n
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:sppmgr:
|
:sppmgr:
|
||||||
@@ -1,15 +1,12 @@
|
|||||||
@set masver=2.6
|
@set masver=2.8
|
||||||
@setlocal DisableDelayedExpansion
|
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
::============================================================================
|
::============================================================================
|
||||||
::
|
::
|
||||||
:: This script is a part of 'Microsoft-Activation-Scripts' (MAS) project.
|
|
||||||
::
|
|
||||||
:: Homepage: mass grave[.]dev
|
:: Homepage: mass grave[.]dev
|
||||||
:: Email: windowsaddict@protonmail.com
|
:: Email: mas.help@outlook.com
|
||||||
::
|
::
|
||||||
::============================================================================
|
::============================================================================
|
||||||
|
|
||||||
@@ -17,37 +14,45 @@
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Set Path variable, it helps if it is misconfigured in the system
|
:: Set environment variables, it helps if they are misconfigured in the system
|
||||||
|
|
||||||
set "PATH=%SystemRoot%\System32;%SystemRoot%\System32\wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
setlocal EnableExtensions
|
||||||
|
setlocal DisableDelayedExpansion
|
||||||
|
|
||||||
|
set "PathExt=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
|
||||||
|
|
||||||
|
set "SysPath=%SystemRoot%\System32"
|
||||||
|
set "Path=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"
|
||||||
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
if exist "%SystemRoot%\Sysnative\reg.exe" (
|
||||||
set "PATH=%SystemRoot%\Sysnative;%SystemRoot%\Sysnative\wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%PATH%"
|
set "SysPath=%SystemRoot%\Sysnative"
|
||||||
|
set "Path=%SystemRoot%\Sysnative;%SystemRoot%;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%"
|
||||||
|
)
|
||||||
|
|
||||||
|
set "ComSpec=%SysPath%\cmd.exe"
|
||||||
|
set "PSModulePath=%ProgramFiles%\WindowsPowerShell\Modules;%SysPath%\WindowsPowerShell\v1.0\Modules"
|
||||||
|
|
||||||
|
set re1=
|
||||||
|
set re2=
|
||||||
|
set "_cmdf=%~f0"
|
||||||
|
for %%# in (%*) do (
|
||||||
|
if /i "%%#"=="re1" set re1=1
|
||||||
|
if /i "%%#"=="re2" set re2=1
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
:: Re-launch the script with x64 process if it was initiated by x86 process on x64 bit Windows
|
||||||
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
:: or with ARM64 process if it was initiated by x86/ARM32 process on ARM64 Windows
|
||||||
|
|
||||||
set "_cmdf=%~f0"
|
if exist %SystemRoot%\Sysnative\cmd.exe if not defined re1 (
|
||||||
for %%# in (%*) do (
|
|
||||||
if /i "%%#"=="r1" set r1=1
|
|
||||||
if /i "%%#"=="r2" set r2=1
|
|
||||||
if /i "%%#"=="-qedit" (
|
|
||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d "1" /f %nul1%
|
|
||||||
rem check the code below admin elevation to understand why it's here
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if exist %SystemRoot%\Sysnative\cmd.exe if not defined r1 (
|
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* r1"
|
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %* re1"
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
:: Re-launch the script with ARM32 process if it was initiated by x64 process on ARM64 Windows
|
||||||
|
|
||||||
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined r2 (
|
if exist %SystemRoot%\SysArm32\cmd.exe if %PROCESSOR_ARCHITECTURE%==AMD64 if not defined re2 (
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* r2"
|
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %* re2"
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -64,10 +69,10 @@ echo:
|
|||||||
echo Null service is not running, script may crash...
|
echo Null service is not running, script may crash...
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
echo Help - %mas%troubleshoot.html
|
echo Help - %mas%troubleshoot
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 10
|
ping 127.0.0.1 -n 20
|
||||||
)
|
)
|
||||||
cls
|
cls
|
||||||
|
|
||||||
@@ -76,9 +81,13 @@ cls
|
|||||||
pushd "%~dp0"
|
pushd "%~dp0"
|
||||||
>nul findstr /v "$" "%~nx0" && (
|
>nul findstr /v "$" "%~nx0" && (
|
||||||
echo:
|
echo:
|
||||||
echo Error: Script either has LF line ending issue or an empty line at the end of the script is missing.
|
echo Error - Script either has LF line ending issue or an empty line at the end of the script is missing.
|
||||||
echo:
|
echo:
|
||||||
ping 127.0.0.1 -n 6 >nul
|
echo:
|
||||||
|
echo Help - %mas%troubleshoot
|
||||||
|
echo:
|
||||||
|
echo:
|
||||||
|
ping 127.0.0.1 -n 20 >nul
|
||||||
popd
|
popd
|
||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
@@ -88,13 +97,16 @@ popd
|
|||||||
|
|
||||||
cls
|
cls
|
||||||
color 07
|
color 07
|
||||||
title Extract $OEM$ Folder %masver%
|
title Extract $OEM$ Folder %masver%
|
||||||
|
|
||||||
set _args=
|
set _args=
|
||||||
set _elev=
|
set _elev=
|
||||||
|
set _unattended=0
|
||||||
|
|
||||||
set _args=%*
|
set _args=%*
|
||||||
if defined _args set _args=%_args:"=%
|
if defined _args set _args=%_args:"=%
|
||||||
|
if defined _args set _args=%_args:re1=%
|
||||||
|
if defined _args set _args=%_args:re2=%
|
||||||
if defined _args (
|
if defined _args (
|
||||||
for %%A in (%_args%) do (
|
for %%A in (%_args%) do (
|
||||||
if /i "%%A"=="-el" set _elev=1
|
if /i "%%A"=="-el" set _elev=1
|
||||||
@@ -106,54 +118,20 @@ set "nul2=2>nul"
|
|||||||
set "nul6=2^>nul"
|
set "nul6=2^>nul"
|
||||||
set "nul=>nul 2>&1"
|
set "nul=>nul 2>&1"
|
||||||
|
|
||||||
set psc=powershell.exe
|
call :dk_setvar
|
||||||
set winbuild=1
|
|
||||||
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
|
||||||
|
|
||||||
set _NCS=1
|
|
||||||
if %winbuild% LSS 10586 set _NCS=0
|
|
||||||
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
|
||||||
|
|
||||||
if %_NCS% EQU 1 (
|
|
||||||
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
|
||||||
set "Red="41;97m""
|
|
||||||
set "Gray="100;97m""
|
|
||||||
set "Green="42;97m""
|
|
||||||
set "Blue="44;97m""
|
|
||||||
set "_White="40;37m""
|
|
||||||
set "_Green="40;92m""
|
|
||||||
set "_Yellow="40;93m""
|
|
||||||
) else (
|
|
||||||
set "Red="Red" "white""
|
|
||||||
set "Gray="Darkgray" "white""
|
|
||||||
set "Green="DarkGreen" "white""
|
|
||||||
set "Blue="Blue" "white""
|
|
||||||
set "_White="Black" "Gray""
|
|
||||||
set "_Green="Black" "Green""
|
|
||||||
set "_Yellow="Black" "Yellow""
|
|
||||||
)
|
|
||||||
|
|
||||||
set "nceline=echo: &echo ==== ERROR ==== &echo:"
|
|
||||||
set "eline=echo: &call :ex_color %Red% "==== ERROR ====" &echo:"
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
if %winbuild% LSS 7600 (
|
if %winbuild% LSS 7600 (
|
||||||
%nceline%
|
%nceline%
|
||||||
echo Unsupported OS version detected [%winbuild%].
|
echo Unsupported OS version detected [%winbuild%].
|
||||||
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalent.
|
echo Project is supported only for Windows 7/8/8.1/10/11 and their Server equivalents.
|
||||||
goto done2
|
|
||||||
)
|
|
||||||
|
|
||||||
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" (
|
|
||||||
%nceline%
|
|
||||||
echo Unable to find powershell.exe in the system.
|
|
||||||
goto done2
|
goto done2
|
||||||
)
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Fix special characters limitation in path name
|
:: Fix special character limitations in path name
|
||||||
|
|
||||||
set "_work=%~dp0"
|
set "_work=%~dp0"
|
||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
|
||||||
@@ -162,6 +140,8 @@ set "_batf=%~f0"
|
|||||||
set "_batp=%_batf:'=''%"
|
set "_batp=%_batf:'=''%"
|
||||||
|
|
||||||
set _PSarg="""%~f0""" -el %_args%
|
set _PSarg="""%~f0""" -el %_args%
|
||||||
|
set _PSarg=%_PSarg:'=''%
|
||||||
|
|
||||||
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
set "_ttemp=%userprofile%\AppData\Local\Temp"
|
||||||
|
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
@@ -171,8 +151,8 @@ setlocal EnableDelayedExpansion
|
|||||||
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
echo "!_batf!" | find /i "!_ttemp!" %nul1% && (
|
||||||
if /i not "!_work!"=="!_ttemp!" (
|
if /i not "!_work!"=="!_ttemp!" (
|
||||||
%eline%
|
%eline%
|
||||||
echo Script is launched from the temp folder,
|
echo The script was launched from the temp folder.
|
||||||
echo Most likely you are running the script directly from the archive file.
|
echo You are most likely running the script directly from the archive file.
|
||||||
echo:
|
echo:
|
||||||
echo Extract the archive file and launch the script from the extracted folder.
|
echo Extract the archive file and launch the script from the extracted folder.
|
||||||
goto done2
|
goto done2
|
||||||
@@ -181,56 +161,112 @@ goto done2
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Check PowerShell
|
||||||
|
|
||||||
%nul1% fltmc || (
|
REM :PowerShellTest: $ExecutionContext.SessionState.LanguageMode :PowerShellTest:
|
||||||
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg:'=''!\"' -verb runas" && exit /b
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PowerShellTest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
%eline%
|
%eline%
|
||||||
echo This script needs admin rights.
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode""
|
||||||
echo To do so, right click on this script and select 'Run as administrator'.
|
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
|
goto done2
|
||||||
)
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: This code disables QuickEdit for this cmd.exe session only without making permanent changes to the registry
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
:: It is added because clicking on the script window pauses the operation and leads to the confusion that script stopped due to an error
|
|
||||||
|
|
||||||
for %%# in (%_args%) do (if /i "%%#"=="-qedit" set quedit=1)
|
%nul1% fltmc || (
|
||||||
|
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b
|
||||||
reg query HKCU\Console /v QuickEdit %nul2% | find /i "0x0" %nul1% || if not defined quedit (
|
%eline%
|
||||||
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d "0" /f %nul1%
|
echo This script needs admin rights.
|
||||||
start cmd.exe /c ""!_batf!" %_args% -qedit"
|
echo Right click on this script and select 'Run as administrator'.
|
||||||
rem quickedit reset code is added at the starting of the script instead of here because it takes time to reflect in some cases
|
goto done2
|
||||||
exit /b
|
|
||||||
)
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
|
if %winbuild% GEQ 17763 (
|
||||||
|
set terminal=1
|
||||||
|
) else (
|
||||||
|
set terminal=
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Check if script is running in Terminal app
|
||||||
|
|
||||||
|
set r1=$TB = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);
|
||||||
|
set r2=%r1% [void]$TB.DefinePInvokeMethod('GetConsoleWindow', 'kernel32.dll', 22, 1, [IntPtr], @(), 1, 3).SetImplementationFlags(128);
|
||||||
|
set r3=%r2% [void]$TB.DefinePInvokeMethod('SendMessageW', 'user32.dll', 22, 1, [IntPtr], @([IntPtr], [UInt32], [IntPtr], [IntPtr]), 1, 3).SetImplementationFlags(128);
|
||||||
|
set d1=%r3% $hIcon = $TB.CreateType(); $hWnd = $hIcon::GetConsoleWindow();
|
||||||
|
set d2=%d1% echo $($hIcon::SendMessageW($hWnd, 127, 0, 0) -ne [IntPtr]::Zero);
|
||||||
|
|
||||||
|
if defined terminal (
|
||||||
|
%psc% "%d2%" %nul2% | find /i "True" %nul1% && set terminal=
|
||||||
|
)
|
||||||
|
|
||||||
|
if defined ps32onArm goto :skipQE
|
||||||
|
if %_unattended%==1 goto :skipQE
|
||||||
|
for %%# in (%_args%) do (if /i "%%#"=="-qedit" goto :skipQE)
|
||||||
|
|
||||||
|
if defined terminal (
|
||||||
|
set "launchcmd=start conhost.exe %psc%"
|
||||||
|
) else (
|
||||||
|
set "launchcmd=%psc%"
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Disable QuickEdit in current session
|
||||||
|
|
||||||
|
set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);"
|
||||||
|
set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);"
|
||||||
|
set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);"
|
||||||
|
set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);"
|
||||||
|
|
||||||
|
%launchcmd% "%d1% %d2% %d3% %d4% & cmd.exe '/c' '!_PSarg! -qedit'" && (exit /b) || (set terminal=1)
|
||||||
|
:skipQE
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check for updates
|
:: Check for updates
|
||||||
|
|
||||||
set -=
|
set -=
|
||||||
set old=
|
set old=
|
||||||
|
|
||||||
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
for /f "delims=[] tokens=2" %%# in ('ping -4 -n 1 updatecheck.mass%-%grave.dev') do (
|
||||||
if not [%%#]==[] (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
if not "%%#"=="" (echo "%%#" | find "127.69" %nul1% && (echo "%%#" | find "127.69.%masver%" %nul1% || set old=1))
|
||||||
)
|
)
|
||||||
|
|
||||||
if defined old (
|
if defined old (
|
||||||
echo ________________________________________________
|
echo ________________________________________________
|
||||||
%eline%
|
%eline%
|
||||||
echo You are running outdated version MAS %masver%
|
echo Your version of MAS [%masver%] is outdated.
|
||||||
echo ________________________________________________
|
echo ________________________________________________
|
||||||
echo:
|
echo:
|
||||||
|
if not %_unattended%==1 (
|
||||||
echo [1] Get Latest MAS
|
echo [1] Get Latest MAS
|
||||||
echo [0] Continue Anyway
|
echo [0] Continue Anyway
|
||||||
echo:
|
echo:
|
||||||
call :ex_color %_Green% "Enter a menu option in the Keyboard [1,0] :"
|
call :dk_color %_Green% "Choose a menu option using your keyboard [1,0] :"
|
||||||
choice /C:10 /N
|
choice /C:10 /N
|
||||||
if !errorlevel!==2 rem
|
if !errorlevel!==2 rem
|
||||||
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
if !errorlevel!==1 (start ht%-%tps://github.com/mass%-%gravel/Microsoft-Acti%-%vation-Scripts & start %mas% & exit /b)
|
||||||
)
|
)
|
||||||
cls
|
)
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
@@ -247,7 +283,7 @@ set "_dir=%desktop%\$OEM$\$$\Setup\Scripts"
|
|||||||
|
|
||||||
if exist "!desktop!\" (
|
if exist "!desktop!\" (
|
||||||
%eline%
|
%eline%
|
||||||
echo Desktop location was not detected, aborting...
|
echo Unable to detect Desktop location, aborting...
|
||||||
goto done2
|
goto done2
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -255,12 +291,12 @@ setlocal EnableDelayedExpansion
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
mode con cols=78 lines=30
|
if not defined terminal mode 78, 30
|
||||||
|
|
||||||
if exist "!desktop!\$OEM$\" (
|
if exist "!desktop!\$OEM$\" (
|
||||||
echo _____________________________________________________
|
echo _____________________________________________________
|
||||||
%eline%
|
%eline%
|
||||||
echo $OEM$ folder already exists on the Desktop.
|
echo The $OEM$ folder already exists on your Desktop.
|
||||||
echo _____________________________________________________
|
echo _____________________________________________________
|
||||||
goto done2
|
goto done2
|
||||||
)
|
)
|
||||||
@@ -296,7 +332,7 @@ goto done2
|
|||||||
:Menu
|
:Menu
|
||||||
|
|
||||||
cls
|
cls
|
||||||
mode con cols=78 lines=30
|
if not defined terminal mode 78, 30
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
echo:
|
echo:
|
||||||
@@ -315,16 +351,16 @@ echo: [7] KMS38 ^(Windows^) ^+ Ohook ^(Office^)
|
|||||||
echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^)
|
echo: [8] KMS38 ^(Windows^) ^+ Online KMS ^(Office^)
|
||||||
echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^)
|
echo: [9] Online KMS ^(Windows^) ^+ Ohook ^(Office^)
|
||||||
echo:
|
echo:
|
||||||
call :ex_color2 %_White% " [R] " %_Green% "ReadMe"
|
call :dk_color2 %_White% " [R] " %_Green% "ReadMe"
|
||||||
echo: [0] Exit
|
echo: [0] Exit
|
||||||
echo: ________________________________________________________
|
echo: ________________________________________________________
|
||||||
echo:
|
echo:
|
||||||
call :ex_color2 %_White% " " %_Green% "Enter a menu option in the Keyboard :"
|
call :dk_color2 %_White% " " %_Green% "Choose a menu option using your keyboard :"
|
||||||
choice /C:123456789R0 /N
|
choice /C:123456789R0 /N
|
||||||
set _erl=%errorlevel%
|
set _erl=%errorlevel%
|
||||||
|
|
||||||
if %_erl%==11 exit /b
|
if %_erl%==11 exit /b
|
||||||
if %_erl%==10 start %mas%oem-folder.html &goto :Menu
|
if %_erl%==10 start %mas%oem-folder &goto :Menu
|
||||||
if %_erl%==9 goto:kms_ohook
|
if %_erl%==9 goto:kms_ohook
|
||||||
if %_erl%==8 goto:kms38_kms
|
if %_erl%==8 goto:kms38_kms
|
||||||
if %_erl%==7 goto:kms38_ohook
|
if %_erl%==7 goto:kms38_ohook
|
||||||
@@ -450,7 +486,7 @@ goto done
|
|||||||
|
|
||||||
fltmc >nul || exit /b
|
fltmc >nul || exit /b
|
||||||
|
|
||||||
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-WindowsOffice
|
call "%~dp0Online_KMS_Activation.cmd" /K-WindowsOffice
|
||||||
|
|
||||||
cd \
|
cd \
|
||||||
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
(goto) 2>nul & (if "%~dp0"=="%SystemRoot%\Setup\Scripts\" rd /s /q "%~dp0")
|
||||||
@@ -525,7 +561,7 @@ call "%~dp0HWID_Activation.cmd" /HWID
|
|||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
setlocal
|
setlocal
|
||||||
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
|
call "%~dp0Online_KMS_Activation.cmd" /K-Office
|
||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
cd \
|
cd \
|
||||||
@@ -601,7 +637,7 @@ call "%~dp0KMS38_Activation.cmd" /KMS38
|
|||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
setlocal
|
setlocal
|
||||||
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Office
|
call "%~dp0Online_KMS_Activation.cmd" /K-Office
|
||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
cd \
|
cd \
|
||||||
@@ -635,7 +671,7 @@ goto done
|
|||||||
fltmc >nul || exit /b
|
fltmc >nul || exit /b
|
||||||
|
|
||||||
setlocal
|
setlocal
|
||||||
call "%~dp0Online_KMS_Activation.cmd" /KMS-ActAndRenewalTask /KMS-Windows
|
call "%~dp0Online_KMS_Activation.cmd" /K-Windows
|
||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
setlocal
|
setlocal
|
||||||
@@ -651,15 +687,15 @@ cd \
|
|||||||
:errorfound
|
:errorfound
|
||||||
|
|
||||||
%eline%
|
%eline%
|
||||||
echo $OEM$ Folder was not created successfully...
|
echo The script failed to create the $OEM$ folder.
|
||||||
goto :done2
|
goto :done2
|
||||||
|
|
||||||
:done
|
:done
|
||||||
|
|
||||||
echo ______________________________________________________________
|
echo ______________________________________________________________
|
||||||
echo:
|
echo:
|
||||||
call :ex_color %Blue% "%oem%"
|
call :dk_color %Blue% "%oem%"
|
||||||
call :ex_color %Green% "$OEM$ folder is successfully created on the Desktop."
|
call :dk_color %Green% "$OEM$ folder was successfully created on your Desktop."
|
||||||
echo "%oem%" | find /i "38" %nul% && (
|
echo "%oem%" | find /i "38" %nul% && (
|
||||||
echo:
|
echo:
|
||||||
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
|
echo To KMS38 activate Server Cor/Acor editions ^(No GUI Versions^),
|
||||||
@@ -670,8 +706,73 @@ echo ______________________________________________________________
|
|||||||
:done2
|
:done2
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
call :ex_color %_Yellow% "Press any key to exit..."
|
if defined fixes (
|
||||||
|
call :dk_color %White% " "
|
||||||
|
call :dk_color %White% "Follow ALL the ABOVE blue lines. "
|
||||||
|
call :dk_color %White% " "
|
||||||
|
echo:
|
||||||
|
call :dk_color2 %Blue% "Press [1] to Open Support Webpage " %Gray% " Press [0] to Ignore"
|
||||||
|
choice /C:10 /N
|
||||||
|
if !errorlevel!==1 (for %%# in (%fixes%) do (start %%#))
|
||||||
|
)
|
||||||
|
|
||||||
|
if defined terminal (
|
||||||
|
call :dk_color %_Yellow% "Press [0] key to %_exitmsg%..."
|
||||||
|
choice /c 0 /n
|
||||||
|
) else (
|
||||||
|
call :dk_color %_Yellow% "Press any key to %_exitmsg%..."
|
||||||
pause %nul1%
|
pause %nul1%
|
||||||
|
)
|
||||||
|
exit /b
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Set variables
|
||||||
|
|
||||||
|
:dk_setvar
|
||||||
|
|
||||||
|
set psc=powershell.exe
|
||||||
|
set winbuild=1
|
||||||
|
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
|
||||||
|
|
||||||
|
set _NCS=1
|
||||||
|
if %winbuild% LSS 10586 set _NCS=0
|
||||||
|
if %winbuild% GEQ 10586 reg query "HKCU\Console" /v ForceV2 %nul2% | find /i "0x0" %nul1% && (set _NCS=0)
|
||||||
|
|
||||||
|
echo "%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%" | find /i "ARM64" %nul1% && (if %winbuild% LSS 21277 set ps32onArm=1)
|
||||||
|
|
||||||
|
if %_NCS% EQU 1 (
|
||||||
|
for /F %%a in ('echo prompt $E ^| cmd') do set "esc=%%a"
|
||||||
|
set "Red="41;97m""
|
||||||
|
set "Gray="100;97m""
|
||||||
|
set "Green="42;97m""
|
||||||
|
set "Blue="44;97m""
|
||||||
|
set "White="107;91m""
|
||||||
|
set "_Red="40;91m""
|
||||||
|
set "_White="40;37m""
|
||||||
|
set "_Green="40;92m""
|
||||||
|
set "_Yellow="40;93m""
|
||||||
|
) else (
|
||||||
|
set "Red="Red" "white""
|
||||||
|
set "Gray="Darkgray" "white""
|
||||||
|
set "Green="DarkGreen" "white""
|
||||||
|
set "Blue="Blue" "white""
|
||||||
|
set "White="White" "Red""
|
||||||
|
set "_Red="Black" "Red""
|
||||||
|
set "_White="Black" "Gray""
|
||||||
|
set "_Green="Black" "Green""
|
||||||
|
set "_Yellow="Black" "Yellow""
|
||||||
|
)
|
||||||
|
|
||||||
|
set "nceline=echo: &echo ==== ERROR ==== &echo:"
|
||||||
|
set "eline=echo: &call :dk_color %Red% "==== ERROR ====" &echo:"
|
||||||
|
if %~z0 GEQ 200000 (
|
||||||
|
set "_exitmsg=Go back"
|
||||||
|
set "_fixmsg=Go back to Main Menu, select Troubleshoot and run Fix Licensing option."
|
||||||
|
) else (
|
||||||
|
set "_exitmsg=Exit"
|
||||||
|
set "_fixmsg=In MAS folder, run Troubleshoot script and select Fix Licensing option."
|
||||||
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
@@ -685,21 +786,21 @@ exit /b
|
|||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:ex_color
|
:dk_color
|
||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[0m
|
echo %esc%[%~1%~2%esc%[0m
|
||||||
) else (
|
) else (
|
||||||
if not exist %psc% (echo %~3) else (%psc% write-host -back '%1' -fore '%2' '%3')
|
%psc% write-host -back '%1' -fore '%2' '%3'
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:ex_color2
|
:dk_color2
|
||||||
|
|
||||||
if %_NCS% EQU 1 (
|
if %_NCS% EQU 1 (
|
||||||
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
echo %esc%[%~1%~2%esc%[%~3%~4%esc%[0m
|
||||||
) else (
|
) else (
|
||||||
if not exist %psc% (echo %~3%~6) else (%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6')
|
%psc% write-host -back '%1' -fore '%2' '%3' -NoNewline; write-host -back '%4' -fore '%5' '%6'
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
84
README.md
84
README.md
@@ -2,61 +2,89 @@
|
|||||||
|
|
||||||
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
<h1 align="center">Microsoft Activation Scripts (MAS)</h1>
|
||||||
|
|
||||||
<p align="center">A Windows and Office activator using HWID / Ohook / KMS38 / Online KMS activation methods, with a focus on open-source code and fewer antivirus detections.</p>
|
<p align="center">Open-source Windows and Office activator featuring HWID, Ohook, KMS38, and Online KMS activation methods, along with advanced troubleshooting.</p>
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://discord.gg/tVFN4N84PP"><img src="https://img.shields.io/badge/Chat%20with%20us%20on%20Discord--blue?style=social&logo=discord" alt="Chat with us without signup" title="Chat with us without signup"></a>
|
|
||||||
<a href="https://www.reddit.com/r/MAS_Activator"><img src="https://img.shields.io/badge/MAS%20on%20Reddit--orange?style=social&logo=reddit" alt="MAS on Reddit" title="MAS on Reddit"></a>
|
|
||||||
<a href="https://twitter.com/massgravel"><img src="https://img.shields.io/twitter/follow/massgravel" alt="Follow us on X" title="Follow us on X"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
## Download / How to use it?
|
## Download / How to use it?
|
||||||
|
|
||||||
### Method 1 - PowerShell (Recommended)
|
### Method 1 - PowerShell (Windows 8 and later) ❤️
|
||||||
|
|
||||||
- Right-click on the Windows start menu and select PowerShell or Terminal (Not CMD).
|
1. Open PowerShell (Not CMD). To do that, right-click on the Windows start menu and select PowerShell or Terminal.
|
||||||
- Copy and paste the code below and press enter
|
2. Copy and paste the code below and press enter
|
||||||
```
|
```
|
||||||
irm https://get.activated.win | iex
|
irm https://get.activated.win | iex
|
||||||
```
|
```
|
||||||
or (deprecated, will be retired on Aug 31 2024, use above instead)
|
3. You will see the activation options. Choose (1) HWID for Windows activation. Choose (2) Ohook for Office activation.
|
||||||
|
4. That's all.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>More options</summary>
|
||||||
|
|
||||||
|
- Alternatively, you can use the following (It will be deprecated in the future.)
|
||||||
```
|
```
|
||||||
irm https://massgrave.dev/get | iex
|
irm https://massgrave.dev/get | iex
|
||||||
```
|
```
|
||||||
- You will see the activation options. Follow the on-screen instructions.
|
- The URL `get.activated.win` might be blocked by some DNS services because it is a new domain.
|
||||||
- That's all.
|
|
||||||
|
</details>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- On older Windows builds you may need to run the below command before,
|
### Method 2 - Traditional (Windows 7 and later)
|
||||||
`[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12`
|
|
||||||
- The Powershell method does not work on Windows 7. Use the Method 2 - Traditional instead.
|
|
||||||
- The URL get.activated.win may be blocked by some DNS services because it is a new domain.
|
|
||||||
|
|
||||||
### Method 2 - Traditional
|
<details>
|
||||||
|
<summary>Click here for info</summary>
|
||||||
|
|
||||||
- Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) or [Bitbucket](https://bitbucket.org/WindowsAddict/microsoft-activation-scripts)
|
1. Download the file under the code button from [GitHub](https://github.com/massgravel/Microsoft-Activation-Scripts) or [Azure DevOps](https://dev.azure.com/massgrave/_git/Microsoft-Activation-Scripts) or [Self-hosted Git](https://git.activated.win/massgrave/Microsoft-Activation-Scripts)
|
||||||
- Right-click on the downloaded zip file and extract
|
2. Right-click on the downloaded zip file and extract
|
||||||
- In the extracted folder, find the folder named `All-In-One-Version`
|
3. In the extracted folder, find the folder named `All-In-One-Version`
|
||||||
- Run the file named `MAS_AIO-CRC32_XXXXXXXX.cmd`
|
4. Run the file named `MAS_AIO.cmd`
|
||||||
- You will see the activation options, follow the on-screen instructions.
|
5. You will see the activation options, follow the on-screen instructions.
|
||||||
- That's all.
|
6. That's all.
|
||||||
|
|
||||||
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches)
|
</details>
|
||||||
|
|
||||||
</br>
|
---
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
>
|
||||||
|
> - The IRM command in PowerShell downloads a script from a specified URL, and the IEX command executes it.
|
||||||
|
> - Always double-check the URL before executing the command and verify the source if manually downloading files.
|
||||||
|
> - Be cautious, as some spread malware disguised as MAS by using different URLs in the IRM command.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
To run the scripts in unattended mode, check [here](https://massgrave.dev/command_line_switches).
|
||||||
|
|
||||||
```
|
```
|
||||||
Latest Version: 2.6
|
Latest Version: 2.8
|
||||||
Release date: 20-Apr-2024
|
Release date: 9-Nov-2024
|
||||||
```
|
```
|
||||||
|
|
||||||
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
### [Troubleshooting / Help](https://massgrave.dev/troubleshoot)
|
||||||
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
### [Download Original Windows & Office](https://massgrave.dev/genuine-installation-media)
|
||||||
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
### Homepage - [https://massgrave.dev/](https://massgrave.dev/)
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
[![1.1]][1]
|
||||||
|
[![1.2]][2]
|
||||||
|
[![1.3]][3]
|
||||||
|
[![1.4]][4]
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
[1.1]: https://massgrave.dev/img/logo_discord.png (Chat with us without signup)
|
||||||
|
[1.2]: https://massgrave.dev/img/logo_github.png (GitHub)
|
||||||
|
[1.3]: https://massgrave.dev/img/logo_reddit.png (Reddit)
|
||||||
|
[1.4]: https://massgrave.dev/img/logo_x.png (Follow us on X)
|
||||||
|
|
||||||
|
[1]: https://discord.gg/tVFN4N84PP
|
||||||
|
[2]: https://github.com/massgravel/Microsoft-Activation-Scripts
|
||||||
|
[3]: https://www.reddit.com/r/MAS_Activator
|
||||||
|
[4]: https://twitter.com/massgravel
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<p align="center">Made with Love ❤️</p>
|
<p align="center">Made with Love ❤️</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user